es.object.from-entries.js 468 B

123456789101112131415
  1. var $ = require('../internals/export');
  2. var iterate = require('../internals/iterate');
  3. var createProperty = require('../internals/create-property');
  4. // `Object.fromEntries` method
  5. // https://github.com/tc39/proposal-object-from-entries
  6. $({ target: 'Object', stat: true }, {
  7. fromEntries: function fromEntries(iterable) {
  8. var obj = {};
  9. iterate(iterable, function (k, v) {
  10. createProperty(obj, k, v);
  11. }, { AS_ENTRIES: true });
  12. return obj;
  13. }
  14. });