diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-05-15 19:08:48 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-05-25 19:07:09 -0300 |
commit | d41853b617e1b0e7fa41309ff0d42611305c3149 (patch) | |
tree | 13d4c0312f95efb22bb103fd3df07f6f0bbb2a79 /src/util/strings.js | |
parent | 4fd0d8b5485f94ad67d32bc6a9273ac4727a6475 (diff) |
bigass code refactor (no more legacy page writes)
Diffstat (limited to 'src/util/strings.js')
-rw-r--r-- | src/util/strings.js | 11 |
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; |