« 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/composite/things/content/withAnnotationParts.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/composite/things/content/withAnnotationParts.js')
-rw-r--r--src/data/composite/things/content/withAnnotationParts.js103
1 files changed, 0 insertions, 103 deletions
diff --git a/src/data/composite/things/content/withAnnotationParts.js b/src/data/composite/things/content/withAnnotationParts.js
deleted file mode 100644
index 15eb74a5..00000000
--- a/src/data/composite/things/content/withAnnotationParts.js
+++ /dev/null
@@ -1,103 +0,0 @@
-import {input, templateCompositeFrom} from '#composite';
-import {empty, transposeArrays} from '#sugar';
-import {is} from '#validators';
-
-import {raiseOutputWithoutDependency} from '#composite/control-flow';
-import {withPropertyFromList} from '#composite/data';
-import {splitContentNodesAround, withContentNodes} from '#composite/wiki-data';
-
-export default templateCompositeFrom({
-  annotation: `withAnnotationParts`,
-
-  inputs: {
-    mode: input({
-      validate: is('strings', 'nodes'),
-    }),
-  },
-
-  outputs: ['#annotationParts'],
-
-  steps: () => [
-    raiseOutputWithoutDependency({
-      dependency: '_annotation',
-      output: input.value({'#annotationParts': []}),
-    }),
-
-    withContentNodes({
-      from: '_annotation',
-    }),
-
-    splitContentNodesAround({
-      nodes: '#contentNodes',
-      around: input.value(/, */g),
-    }),
-
-    {
-      dependencies: ['#contentNodeLists'],
-      compute: (continuation, {
-        ['#contentNodeLists']: nodeLists,
-      }) => continuation({
-        ['#contentNodeLists']:
-          nodeLists.filter(list => !empty(list)),
-      }),
-    },
-
-    {
-      dependencies: ['#contentNodeLists', input('mode')],
-      compute: (continuation, {
-        ['#contentNodeLists']: nodeLists,
-        [input('mode')]: mode,
-      }) =>
-        (mode === 'nodes'
-          ? continuation.raiseOutput({'#annotationParts': nodeLists})
-          : continuation()),
-    },
-
-    {
-      dependencies: ['#contentNodeLists'],
-
-      compute: (continuation, {
-        ['#contentNodeLists']: nodeLists,
-      }) => continuation({
-        ['#firstNodes']:
-          nodeLists.map(list => list.at(0)),
-
-        ['#lastNodes']:
-          nodeLists.map(list => list.at(-1)),
-      }),
-    },
-
-    withPropertyFromList({
-      list: '#firstNodes',
-      property: input.value('i'),
-    }).outputs({
-      '#firstNodes.i': '#startIndices',
-    }),
-
-    withPropertyFromList({
-      list: '#lastNodes',
-      property: input.value('iEnd'),
-    }).outputs({
-      '#lastNodes.iEnd': '#endIndices',
-    }),
-
-    {
-      dependencies: [
-        'annotation',
-        '#startIndices',
-        '#endIndices',
-      ],
-
-      compute: (continuation, {
-        ['annotation']: annotation,
-        ['#startIndices']: startIndices,
-        ['#endIndices']: endIndices,
-      }) => continuation({
-        ['#annotationParts']:
-          transposeArrays([startIndices, endIndices])
-            .map(([start, end]) =>
-              annotation.slice(start, end)),
-      }),
-    },
-  ],
-});