1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// Gets the track's own date. This is either its dateFirstReleased property
// or, if unset, the album's date.
import {input, templateCompositeFrom} from '#composite';
import withPropertyFromAlbum from './withPropertyFromAlbum.js';
export default templateCompositeFrom({
annotation: `withDate`,
outputs: ['#date'],
steps: () => [
{
dependencies: ['dateFirstReleased'],
compute: (continuation, {dateFirstReleased}) =>
(dateFirstReleased
? continuation.raiseOutput({'#date': dateFirstReleased})
: continuation()),
},
withPropertyFromAlbum({
property: input.value('date'),
}),
{
dependencies: ['#album.date'],
compute: (continuation, {['#album.date']: albumDate}) =>
(albumDate
? continuation.raiseOutput({'#date': albumDate})
: continuation.raiseOutput({'#date': null})),
},
],
})
|