diff options
Diffstat (limited to 'src/util/sugar.js')
-rw-r--r-- | src/util/sugar.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util/sugar.js b/src/util/sugar.js index 0813c1d4..c60bddb6 100644 --- a/src/util/sugar.js +++ b/src/util/sugar.js @@ -150,6 +150,15 @@ export function bindOpts(fn, bind) { value: fn.name ? `(options-bound) ${fn.name}` : `(options-bound)`, }); + for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(fn))) { + if (key === 'length') continue; + if (key === 'name') continue; + if (key === 'arguments') continue; + if (key === 'caller') continue; + if (key === 'prototype') continue; + Object.defineProperty(bound, key, descriptor); + } + return bound; } |