« get me outta code hell

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:
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],
   });