« 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
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/sugar.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/util/sugar.js b/src/util/sugar.js
index f425989b..99f706f1 100644
--- a/src/util/sugar.js
+++ b/src/util/sugar.js
@@ -82,10 +82,16 @@ export function escapeRegex(string) {
 export function bindOpts(fn, bind) {
     const bindIndex = bind[bindOpts.bindIndex] ?? 1;
 
-    return (...args) => {
+    const bound = function(...args) {
         const opts = args[bindIndex] ?? {};
         return fn(...args.slice(0, bindIndex), {...bind, ...opts});
     };
+
+    Object.defineProperty(bound, 'name', {
+        value: (fn.name ? `(options-bound) ${fn.name}` : `(options-bound)`)
+    });
+
+    return bound;
 }
 
 bindOpts.bindIndex = Symbol();