« 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/sugar.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/sugar.js')
-rw-r--r--src/util/sugar.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util/sugar.js b/src/util/sugar.js
index 0813c1d..c60bddb 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;
 }