« get me outta code hell

data: soupy reverse - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-data/gobbleSoupyReverse.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-11 20:49:26 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-11 20:49:26 -0400
commit77fc589466fc0c04326231638c5ec6026e7948d4 (patch)
treedbc019e4f72851bd3fa8fd5195d87fe6f6177f7c /src/data/composite/wiki-data/gobbleSoupyReverse.js
parent3bb0a89e80fddb985cc1fc4775e58b0d4a7445dc (diff)
data: soupy reverse
Diffstat (limited to 'src/data/composite/wiki-data/gobbleSoupyReverse.js')
-rw-r--r--src/data/composite/wiki-data/gobbleSoupyReverse.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/data/composite/wiki-data/gobbleSoupyReverse.js b/src/data/composite/wiki-data/gobbleSoupyReverse.js
new file mode 100644
index 00000000..86a1061c
--- /dev/null
+++ b/src/data/composite/wiki-data/gobbleSoupyReverse.js
@@ -0,0 +1,39 @@
+import {input, templateCompositeFrom} from '#composite';
+
+import {withPropertyFromObject} from '#composite/data';
+
+import inputSoupyReverse, {getSoupyReverseInputKey} from './inputSoupyReverse.js';
+
+export default templateCompositeFrom({
+  annotation: `gobbleSoupyReverse`,
+
+  inputs: {
+    reverse: inputSoupyReverse(),
+  },
+
+  outputs: ['#reverse'],
+
+  steps: () => [
+    {
+      dependencies: [input('reverse')],
+      compute: (continuation, {
+        [input('reverse')]: reverse,
+      }) =>
+        (typeof reverse === 'function'
+          ? continuation.raiseOutput({
+              ['#reverse']: reverse,
+            })
+          : continuation({
+              ['#key']:
+                getSoupyReverseInputKey(reverse),
+            })),
+    },
+
+    withPropertyFromObject({
+      object: 'reverse',
+      property: '#key',
+    }).outputs({
+      '#value': '#reverse',
+    }),
+  ],
+});