diff options
Diffstat (limited to 'src/util/sugar.js')
-rw-r--r-- | src/util/sugar.js | 8 |
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(); |