diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-11-03 13:22:08 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-11-14 07:59:22 -0400 |
commit | 60f007a20db3547c57b1b1f84510707b38a4076a (patch) | |
tree | b401118bc40ce493fe5fd243a3472cf6986e9053 /src/data/composite/things/track/withSuffixDirectoryFromAlbum.js | |
parent | 163c541f4b8244f3c2fd8568ab3ef5cc4ed114a2 (diff) |
data: Album.suffixTrackDirectories
Diffstat (limited to 'src/data/composite/things/track/withSuffixDirectoryFromAlbum.js')
-rw-r--r-- | src/data/composite/things/track/withSuffixDirectoryFromAlbum.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/data/composite/things/track/withSuffixDirectoryFromAlbum.js b/src/data/composite/things/track/withSuffixDirectoryFromAlbum.js new file mode 100644 index 00000000..7159a3f4 --- /dev/null +++ b/src/data/composite/things/track/withSuffixDirectoryFromAlbum.js @@ -0,0 +1,53 @@ +import {input, templateCompositeFrom} from '#composite'; + +import {withResultOfAvailabilityCheck} from '#composite/control-flow'; + +import withPropertyFromAlbum from './withPropertyFromAlbum.js'; + +export default templateCompositeFrom({ + annotation: `withSuffixDirectoryFromAlbum`, + + inputs: { + flagValue: input({ + defaultDependency: 'suffixDirectoryFromAlbum', + acceptsNull: true, + }), + }, + + outputs: ['#suffixDirectoryFromAlbum'], + + steps: () => [ + withResultOfAvailabilityCheck({ + from: 'suffixDirectoryFromAlbum', + }), + + { + dependencies: [ + '#availability', + 'suffixDirectoryFromAlbum' + ], + + compute: (continuation, { + ['#availability']: availability, + ['suffixDirectoryFromAlbum']: flagValue, + }) => + (availability + ? continuation.raiseOutput({['#suffixDirectoryFromAlbum']: flagValue}) + : continuation()), + }, + + withPropertyFromAlbum({ + property: input.value('suffixTrackDirectories'), + }), + + { + dependencies: ['#album.suffixTrackDirectories'], + compute: (continuation, { + ['#album.suffixTrackDirectories']: suffixTrackDirectories, + }) => continuation({ + ['#suffixDirectoryFromAlbum']: + suffixTrackDirectories, + }), + }, + ], +}); |