es.object.from-entries.js 477 B

12345678910111213141516
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var iterate = require('../internals/iterate');
  4. var createProperty = require('../internals/create-property');
  5. // `Object.fromEntries` method
  6. // https://tc39.es/ecma262/#sec-object.fromentries
  7. $({ target: 'Object', stat: true }, {
  8. fromEntries: function fromEntries(iterable) {
  9. var obj = {};
  10. iterate(iterable, function (k, v) {
  11. createProperty(obj, k, v);
  12. }, { AS_ENTRIES: true });
  13. return obj;
  14. }
  15. });