diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-01-11 17:35:02 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-01-11 17:35:02 -0400 |
commit | cde9bdcdd35ecf9246552af192876a84d21f60ea (patch) | |
tree | 797706b05ec45d309764870bd14c5b817518e925 /src/reverse.js | |
parent | 1cc21e130e691d79677c62362a17070597e1ee93 (diff) |
reverse: artworksWhichReference
Diffstat (limited to 'src/reverse.js')
-rw-r--r-- | src/reverse.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/reverse.js b/src/reverse.js index 9b642e39..22746d24 100644 --- a/src/reverse.js +++ b/src/reverse.js @@ -74,7 +74,28 @@ function reverseHelper(spec) { }; } -const hardcodedReverseSpecs = {}; +const hardcodedReverseSpecs = { + // Artworks aren't Thing objects. + // This spec operates on albums and tracks alike! + artworksWhichReference: { + bindTo: 'wikiData', + + referencing: ({albumData, trackData}) => + [...albumData, ...trackData] + .flatMap(referencingThing => + referencingThing.referencedArtworks + .map(({thing: referencedThing, ...referenceDetails}) => ({ + referencingThing, + referencedThing, + referenceDetails, + }))), + + referenced: ({referencedThing}) => [referencedThing], + + tidy: ({referencingThing, referenceDetails}) => + ({thing: referencingThing, ...referenceDetails}), + }, +}; const findReverseHelperConfig = { word: `reverse`, |