summaryrefslogtreecommitdiff
path: root/src/util.js
blob: 9f525517c3020c622406be758389e039106a57b9 (plain)
1
2
3
4
5
6
7
8
9
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);
};