diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-04-24 21:52:57 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-04-24 21:52:57 -0300 |
commit | 8e0c17d921cb57970dc9a681c07e44aace790082 (patch) | |
tree | 4048fb9aefdf7c12120a4b3e507b2a807a4542cc | |
parent | 2edbfa62f627469d399917d77d44474fc7b0679c (diff) |
annotate bindOpts function name
-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(); |