« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util/strings.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/strings.js')
-rw-r--r--src/util/strings.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/util/strings.js b/src/util/strings.js
index 99104aa3..c0664351 100644
--- a/src/util/strings.js
+++ b/src/util/strings.js
@@ -1,4 +1,5 @@
 import { logWarn } from './cli.js';
+import { bindOpts } from './sugar.js';
 
 // Localiz8tion time! Or l10n as the neeeeeeeerds call it. Which is a terri8le
 // name and not one I intend on using, thank you very much. (Don't even get me
@@ -194,13 +195,13 @@ export function genStrings(stringsJSON, {
         }
     };
 
-    const bindOpts = (obj, bind) => Object.fromEntries(Object.entries(obj).map(
-        ([ key, fn ]) => [key, (value, opts = {}) => fn(value, {...bind, ...opts})]
-    ));
-
     // And the provided utility dictionaries themselves, of course!
     for (const [key, utilDict] of Object.entries(bindUtilities)) {
-        strings[key] = bindOpts(utilDict, {strings});
+        const boundUtilDict = {};
+        for (const [key, fn] of Object.entries(utilDict)) {
+            boundUtilDict[key] = bindOpts(fn, {strings});
+        }
+        strings[key] = boundUtilDict;
     }
 
     return strings;