« get me outta code hell

withAlbum.js « track-section « things « composite « data « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/things/track-section/withAlbum.js
blob: 608cc0cd78f795f42248c24efbddaf098f73ac96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Gets the track section's album. This will early exit if ownAlbumData is
// missing. If there's no album whose list of track sections includes this one,
// the output dependency will be null.

import {input, templateCompositeFrom} from '#composite';

import {withUniqueReferencingThing} from '#composite/wiki-data';

export default templateCompositeFrom({
  annotation: `withAlbum`,

  outputs: ['#album'],

  steps: () => [
    withUniqueReferencingThing({
      data: 'ownAlbumData',
      list: input.value('trackSections'),
    }).outputs({
      ['#uniqueReferencingThing']: '#album',
    }),
  ],
});