« 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
diff options
context:
space:
mode:
Diffstat (limited to 'src/data')
-rw-r--r--src/data/composite/things/content/hasAnnotationPart.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/data/composite/things/content/hasAnnotationPart.js b/src/data/composite/things/content/hasAnnotationPart.js
index f989d829..8b2cbb8b 100644
--- a/src/data/composite/things/content/hasAnnotationPart.js
+++ b/src/data/composite/things/content/hasAnnotationPart.js
@@ -1,6 +1,6 @@
 import {input, templateCompositeFrom} from '#composite';
 
-import {exposeWhetherDependencyAvailable} from '#composite/control-flow';
+import {exitWithoutDependency} from '#composite/control-flow';
 
 import withAnnotationParts from './withAnnotationParts.js';
 
@@ -18,14 +18,24 @@ export default templateCompositeFrom({
       mode: input.value('strings'),
     }),
 
-    withIndexInList({
-      item: input('part'),
-      list: '#annotationParts',
+    exitWithoutDependency({
+      dependency: '#annotationParts',
+      value: input.value(false),
     }),
 
-    exposeWhetherDependencyAvailable({
-      dependency: '#index',
-      mode: input.value('index'),
-    }),
+    {
+      dependencies: [
+        input('part'),
+        '#annotationParts',
+      ],
+
+      compute: ({
+        [input('part')]: search,
+        ['#annotationParts']: parts,
+      }) =>
+        parts.some(part =>
+          part.toLowerCase() ===
+          search.toLowerCase()),
+    },
   ],
 });