« 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/yaml.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/yaml.js')
-rw-r--r--src/data/yaml.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index b766e753..006513be 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -790,24 +790,29 @@ export function parseAnnotatedReferences(entries, {
 }
 
 export function parseArtwork({
+  fileExtensionFromThingProperty,
   dateFromThingProperty,
   artistContribsFromThingProperty,
   artistContribsArtistProperty,
 }) {
+  const provide = {
+    fileExtensionFromThingProperty,
+    dateFromThingProperty,
+    artistContribsFromThingProperty,
+    artistContribsArtistProperty,
+  };
+
   const parseSingleEntry = (entry, {subdoc, Artwork}) =>
-    subdoc(Artwork, entry, {
-      bindInto: 'thing',
-      provide: {
-        dateFromThingProperty,
-        artistContribsFromThingProperty,
-        artistContribsArtistProperty,
-      },
-    });
+    subdoc(Artwork, entry, {bindInto: 'thing', provide});
 
-  return (value, ...args) =>
+  const transform = (value, ...args) =>
     (Array.isArray(value)
       ? value.map(entry => parseSingleEntry(entry, ...args))
       : [parseSingleEntry(value, ...args)]);
+
+  transform.provide = provide;
+
+  return transform;
 }
 
 // documentModes: Symbols indicating sets of behavior for loading and processing