« get me outta code hell

data-steps: initial commit - 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:
author(quasar) nebula <qznebula@protonmail.com>2023-03-06 10:27:40 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-03-06 10:27:40 -0400
commitda4eda535893f1a26b095e5890658099e89d9457 (patch)
tree33106463203e86fd8bbedb2ac820adde99c9c47e /src/util/sugar.js
parent54509b203a2119fa66c09bef6da4a2fccf8219e8 (diff)
data-steps: initial commit
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 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;
 }