« get me outta code hell

data, test: withParsedCommentaryEntries - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-14 22:20:45 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-14 22:26:19 -0400
commit6deea0629a3f3b9985d205d2f3a048893ea938c9 (patch)
tree5bed06c9f8616e1f07e73051b33e94cc16768335 /src/data/composite/wiki-properties
parent764b6a3a2c89d0e4d948862bfeb546d33bbf45e6 (diff)
data, test: withParsedCommentaryEntries
Diffstat (limited to 'src/data/composite/wiki-properties')
-rw-r--r--src/data/composite/wiki-properties/commentary.js32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/data/composite/wiki-properties/commentary.js b/src/data/composite/wiki-properties/commentary.js
index fbea9d5c..cd6b7ac4 100644
--- a/src/data/composite/wiki-properties/commentary.js
+++ b/src/data/composite/wiki-properties/commentary.js
@@ -1,12 +1,30 @@
 // Artist commentary! Generally present on tracks and albums.
 
+import {input, templateCompositeFrom} from '#composite';
 import {isCommentary} from '#validators';
 
-// TODO: Not templateCompositeFrom.
+import {exitWithoutDependency, exposeDependency}
+  from '#composite/control-flow';
+import {withParsedCommentaryEntries} from '#composite/wiki-data';
 
-export default function() {
-  return {
-    flags: {update: true, expose: true},
-    update: {validate: isCommentary},
-  };
-}
+export default templateCompositeFrom({
+  annotation: `commentary`,
+
+  compose: false,
+
+  steps: () => [
+    exitWithoutDependency({
+      dependency: input.updateValue({validate: isCommentary}),
+      mode: input.value('falsy'),
+      value: input.value(null),
+    }),
+
+    withParsedCommentaryEntries({
+      from: input.updateValue(),
+    }),
+
+    exposeDependency({
+      dependency: '#parsedCommentaryEntries',
+    }),
+  ],
+});