summaryrefslogtreecommitdiff
path: root/src/util.js
diff options
context:
space:
mode:
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);
+};