« get me outta code hell

data: constitutibleArtwork & related infrastructure - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties/soupyReverse.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-04-08 18:20:58 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:42 -0300
commita0a7f15520b55043d9321a455a49a33558254aa1 (patch)
tree45100197560ff46178f33b975ef5d287260b0c69 /src/data/composite/wiki-properties/soupyReverse.js
parent670d442f1840586085094c9d59d354f8e3b54549 (diff)
data: constitutibleArtwork & related infrastructure
Diffstat (limited to 'src/data/composite/wiki-properties/soupyReverse.js')
-rw-r--r--src/data/composite/wiki-properties/soupyReverse.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/data/composite/wiki-properties/soupyReverse.js b/src/data/composite/wiki-properties/soupyReverse.js
index b99c45da..784a66b4 100644
--- a/src/data/composite/wiki-properties/soupyReverse.js
+++ b/src/data/composite/wiki-properties/soupyReverse.js
@@ -20,12 +20,16 @@ soupyReverse.contributionsBy =
   });
 
 soupyReverse.artworkContributionsBy =
-  (bindTo, artworkProperty) => ({
+  (bindTo, artworkProperty, {single = false} = {}) => ({
     bindTo,
 
     referencing: thing =>
-      thing[artworkProperty]
-        .flatMap(artwork => artwork.artistContribs),
+      (single
+        ? (thing[artworkProperty]
+            ? thing[artworkProperty].artistContribs
+            : [])
+        : thing[artworkProperty]
+            .flatMap(artwork => artwork.artistContribs)),
 
     referenced: contrib => [contrib.artist],
   });