« get me outta code hell

data: signature changes to misc compositional functions - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/thing.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-08-22 13:52:43 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-05 21:02:49 -0300
commit1481db921e645ab09aad3a57b4ce308e2c57d738 (patch)
tree48927481659bfe0cb9967d08b6656f5479ca2474 /src/data/things/thing.js
parent75691866ed68b9261dd920b79d4ab214df3f049b (diff)
data: signature changes to misc compositional functions
Diffstat (limited to 'src/data/things/thing.js')
-rw-r--r--src/data/things/thing.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index bc10e06b..f1ae6c71 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -577,14 +577,18 @@ export default class Thing extends CacheableObject {
       return constructedDescriptor;
     },
 
-    withDynamicContribs: (contribsByRefProperty, dependencyName) => ({
+    // Resolves the contribsByRef contained in the provided dependency,
+    // providing (named by the second argument) the result. "Resolving"
+    // means mapping the "who" reference of each contribution to an artist
+    // object, and filtering out those whose "who" doesn't match any artist.
+    withResolvedContribs: ({from: contribsByRefDependency, to: outputDependency}) => ({
       flags: {expose: true, compose: true},
 
       expose: {
-        dependencies: ['artistData', contribsByRefProperty],
-        compute: ({artistData, [contribsByRefProperty]: contribsByRef}, callback) =>
+        dependencies: ['artistData', contribsByRefDependency],
+        compute: ({artistData, [contribsByRefDependency]: contribsByRef}, callback) =>
           callback({
-            [dependencyName]:
+            [outputDependency]:
               Thing.findArtistsFromContribs(contribsByRef, artistData),
           }),
       },