« get me outta code hell

find, reverse: fr.bind + bindReverse - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/write
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-11 17:05:25 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-11 17:05:25 -0400
commit13f91d9ff89dcf0ca8b7895b21b1e0cf43df38f9 (patch)
treef25a02cd225c505ec8d1b16f5f3b59e77f8fd4a8 /src/write
parent3cc050187760c758c4760121281ff9a7e0b626f5 (diff)
find, reverse: fr.bind + bindReverse
Diffstat (limited to 'src/write')
-rw-r--r--src/write/build-modes/repl.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/write/build-modes/repl.js b/src/write/build-modes/repl.js
index ff64ee82..920ad9f7 100644
--- a/src/write/build-modes/repl.js
+++ b/src/write/build-modes/repl.js
@@ -36,7 +36,7 @@ import * as path from 'node:path';
 import * as repl from 'node:repl';
 
 import _find, {bindFind} from '#find';
-import _reverse from '#reverse';
+import _reverse, {bindReverse} from '#reverse';
 import CacheableObject from '#cacheable-object';
 import {logWarn} from '#cli';
 import {debugComposite} from '#composite';
@@ -67,6 +67,15 @@ export async function getContextAssignments({
     logWarn`\`find\` variable will be missing`;
   }
 
+  let reverse;
+  try {
+    reverse = bindReverse(wikiData);
+  } catch (error) {
+    console.error(error);
+    logWarn`Failed to prepare wikiData-bound reverse() functions`;
+    logWarn`\`reverse\` variable will be missing`;
+  }
+
   const replContext = {
     universalUtilities,
     ...universalUtilities,
@@ -97,6 +106,8 @@ export async function getContextAssignments({
     bindFind,
 
     _reverse,
+    reverse,
+    bindReverse,
 
     showAggregate,
   };