summaryrefslogtreecommitdiff
path: root/src/util.js
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-08-01 17:40:53 -0500
committersanine-a <sanine.not@pm.me>2023-08-01 17:40:53 -0500
commiteb03b3a341f3c8152db4ee2ee99b85cffb27796e (patch)
treeb617069542b540cc9083f8481c881fc6a3819e52 /src/util.js
parent6aae1f6fb4cf289ecf5ed318b34c0e7df62bbf83 (diff)
add util.js
Diffstat (limited to 'src/util.js')
-rw-r--r--src/util.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.js b/src/util.js
new file mode 100644
index 0000000..9f52551
--- /dev/null
+++ b/src/util.js
@@ -0,0 +1,10 @@
+'use strict';
+
+
+export function create(obj, proto=Object.prototype) {
+ const props = Object.keys(obj)
+ .map((key) => [ key, { value: obj[key], enumerable: true } ])
+ .reduce((acc, [ key, value ]) => ({ ...acc, [key]: value }), {});
+
+ return Object.create(proto, props);
+};