« get me outta code hell

data: hasAnnotationPart: case-insensitive - 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:
author(quasar) nebula <qznebula@protonmail.com>2025-05-01 15:06:59 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-05-06 12:29:06 -0300
commit97ec3e59db827876ea5b4233afac37407553be50 (patch)
tree367358205663aad20a6d3fb8a95c92de691c65d3 /src/data
parent9c49b349785eea14e29a489b3f78784c659316f8 (diff)
data: hasAnnotationPart: case-insensitive
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()),
+    },
   ],
 });