From 8e0c17d921cb57970dc9a681c07e44aace790082 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 24 Apr 2022 21:52:57 -0300 Subject: annotate bindOpts function name --- src/util/sugar.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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(); -- cgit 1.3.0-6-gf8a5