From 861810685da73fa9fd6d4a1cb965155c61c99d11 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 27 Nov 2025 19:51:01 -0400 Subject: composite, data: positional inputs, V(...) basic backwards-compatible implementation, and a small amount of demo usage --- src/data/things/track.js | 51 +++++++++++------------------------------------- 1 file changed, 11 insertions(+), 40 deletions(-) (limited to 'src/data/things/track.js') diff --git a/src/data/things/track.js b/src/data/things/track.js index 39a1804f..030778a3 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -2,7 +2,7 @@ import {inspect} from 'node:util'; import CacheableObject from '#cacheable-object'; import {colors} from '#cli'; -import {input} from '#composite'; +import {input, V} from '#composite'; import {onlyItem} from '#sugar'; import {sortByDate} from '#sort'; import Thing from '#thing'; @@ -141,14 +141,8 @@ export class Track extends Thing { validate: input.value(isBoolean), }), - withPropertyFromObject({ - object: 'trackSection', - property: input.value('suffixTrackDirectories'), - }), - - exposeDependency({ - dependency: '#trackSection.suffixTrackDirectories', - }), + withPropertyFromObject('trackSection', V('suffixTrackDirectories')), + exposeDependency('#trackSection.suffixTrackDirectories'), ], // Controls how find.track works - it'll never be matched by @@ -160,10 +154,7 @@ export class Track extends Thing { validate: input.value(isBoolean), }), - withPropertyFromObject({ - object: 'album', - property: input.value('alwaysReferenceTracksByDirectory'), - }), + withPropertyFromObject('album', V('alwaysReferenceTracksByDirectory')), // Falsy mode means this exposes true if the album's property is true, // but continues if the property is false (which is also the default). @@ -172,20 +163,10 @@ export class Track extends Thing { mode: input.value('falsy'), }), - exitWithoutDependency({ - dependency: '_mainRelease', - value: input.value(false), - }), + exitWithoutDependency('_mainRelease', V(false)), + exitWithoutDependency('mainReleaseTrack', V(false)), - exitWithoutDependency({ - dependency: 'mainReleaseTrack', - value: input.value(false), - }), - - withPropertyFromObject({ - object: 'mainReleaseTrack', - property: input.value('name'), - }), + withPropertyFromObject('mainReleaseTrack', V('name')), { dependencies: ['name', '#mainReleaseTrack.name'], @@ -248,9 +229,7 @@ export class Track extends Thing { '#resolvedReference': '#sameNameSingle', }), - exposeDependencyOrContinue({ - dependency: '#sameNameSingle', - }), + exposeDependencyOrContinue('#sameNameSingle'), { dependencies: [ @@ -321,18 +300,10 @@ export class Track extends Thing { validate: input.value(isContentString), }), - exposeDependencyOrContinue({ - dependency: '_artistText', - }), - - withPropertyFromObject({ - object: 'album', - property: input.value('trackArtistText'), - }), + exposeDependencyOrContinue('_artistText'), - exposeDependency({ - dependency: '#album.trackArtistText', - }), + withPropertyFromObject('album', V('trackArtistText')), + exposeDependency('#album.trackArtistText'), ], artistContribs: [ -- cgit 1.3.0-6-gf8a5