implementation.js 669 B

123456789101112131415161718
  1. 'use strict';
  2. var AddEntriesFromIterable = require('es-abstract/2021/AddEntriesFromIterable');
  3. var CreateDataPropertyOrThrow = require('es-abstract/2021/CreateDataPropertyOrThrow');
  4. var RequireObjectCoercible = require('es-abstract/2021/RequireObjectCoercible');
  5. var ToPropertyKey = require('es-abstract/2021/ToPropertyKey');
  6. var adder = function addDataProperty(key, value) {
  7. var O = this; // eslint-disable-line no-invalid-this
  8. var propertyKey = ToPropertyKey(key);
  9. CreateDataPropertyOrThrow(O, propertyKey, value);
  10. };
  11. module.exports = function fromEntries(iterable) {
  12. RequireObjectCoercible(iterable);
  13. return AddEntriesFromIterable({}, iterable, adder);
  14. };