object.fromentries
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -0,1 +1,12 @@ | ||
2.0.3 / 2020-11-26 | ||
================= | ||
* [Deps] update `es-abstract`; remove `function-bind`; use `call-bind` where applicable | ||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `aud`, `safe-publish-latest` | ||
* [actions] add "Allow Edits" workflow | ||
* [actions] switch Automatic Rebase workflow to `pull_request_target` event | ||
* [Tests] migrate tests to Github Actions | ||
* [Tests] run `nyc` on all tests | ||
* [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner | ||
* [Tests] only audit prod deps | ||
2.0.2 / 2019-12-12 | ||
@@ -2,0 +13,0 @@ ================= |
'use strict'; | ||
var AddEntriesFromIterable = require('es-abstract/2019/AddEntriesFromIterable'); | ||
var CreateDataPropertyOrThrow = require('es-abstract/2019/CreateDataPropertyOrThrow'); | ||
var Get = require('es-abstract/2019/Get'); | ||
var IsArray = require('es-abstract/2019/IsArray'); | ||
var RequireObjectCoercible = require('es-abstract/2019/RequireObjectCoercible'); | ||
var ToPropertyKey = require('es-abstract/2019/ToPropertyKey'); | ||
var Type = require('es-abstract/2019/Type'); | ||
var AddEntriesFromIterable = require('es-abstract/2020/AddEntriesFromIterable'); | ||
var CreateDataPropertyOrThrow = require('es-abstract/2020/CreateDataPropertyOrThrow'); | ||
var RequireObjectCoercible = require('es-abstract/2020/RequireObjectCoercible'); | ||
var ToPropertyKey = require('es-abstract/2020/ToPropertyKey'); | ||
@@ -17,33 +14,6 @@ var adder = function addDataProperty(key, value) { | ||
var legacyAssign = function assign(obj, entries) { | ||
for (var i = 0; i < entries.length; ++i) { | ||
var entry = entries[i]; | ||
if (Type(entry) !== 'Object') { | ||
throw new TypeError('iterator returned a non-object; entry expected'); | ||
} | ||
var key = Get(entry, '0'); | ||
var value = Get(entry, '1'); | ||
var propertyKey = ToPropertyKey(key); | ||
CreateDataPropertyOrThrow(obj, propertyKey, value); | ||
} | ||
}; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; | ||
module.exports = function fromEntries(iterable) { | ||
RequireObjectCoercible(iterable); | ||
var obj = {}; | ||
// this part isn't in the spec, it's for a reasonable fallback for pre-ES6 environments | ||
if (!hasSymbols) { | ||
if (!IsArray(iterable)) { | ||
throw new TypeError('this environment lacks native Symbols, and can not support non-Array iterables'); | ||
} | ||
legacyAssign(obj, iterable); | ||
return obj; | ||
} | ||
return AddEntriesFromIterable(obj, iterable, adder); | ||
return AddEntriesFromIterable({}, iterable, adder); | ||
}; |
'use strict'; | ||
var define = require('define-properties'); | ||
var bind = require('function-bind'); | ||
var callBind = require('call-bind'); | ||
@@ -10,3 +10,3 @@ var implementation = require('./implementation'); | ||
var polyfill = bind.call(getPolyfill()); | ||
var polyfill = callBind(getPolyfill(), Object); | ||
@@ -13,0 +13,0 @@ define(polyfill, { |
{ | ||
"name": "object.fromentries", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"author": "Jordan Harband <ljharb@gmail.com>", | ||
@@ -12,11 +12,9 @@ "funding": { | ||
"scripts": { | ||
"pretest": "npm run --silent lint", | ||
"test": "npm run --silent tests-only", | ||
"posttest": "npx aud", | ||
"tests-only": "es-shim-api --bound && npm run --silent test:shimmed && npm run --silent test:module", | ||
"test:shimmed": "node test/shimmed.js", | ||
"test:module": "node test/index.js", | ||
"coverage": "covert test/*.js", | ||
"coverage-quiet": "covert test/*.js --quiet", | ||
"lint": "eslint test/*.js *.js" | ||
"prepublish": "safe-publish-latest", | ||
"pretest": "npm run lint", | ||
"test": "npm run tests-only", | ||
"posttest": "aud --production", | ||
"tests-only": "nyc tape 'test/**/*.js'", | ||
"lint": "eslint .", | ||
"postlint": "es-shim-api --bound" | ||
}, | ||
@@ -44,5 +42,5 @@ "repository": { | ||
"dependencies": { | ||
"call-bind": "^1.0.0", | ||
"define-properties": "^1.1.3", | ||
"es-abstract": "^1.17.0-next.1", | ||
"function-bind": "^1.1.1", | ||
"es-abstract": "^1.18.0-next.1", | ||
"has": "^1.0.3" | ||
@@ -52,7 +50,10 @@ }, | ||
"@es-shims/api": "^2.1.2", | ||
"@ljharb/eslint-config": "^15.0.2", | ||
"@ljharb/eslint-config": "^17.3.0", | ||
"array-map": "^0.0.0", | ||
"covert": "^1.1.1", | ||
"eslint": "^6.7.2", | ||
"tape": "^4.11.0" | ||
"aud": "^1.1.3", | ||
"eslint": "^7.14.0", | ||
"has-strict-mode": "^1.0.0", | ||
"nyc": "^10.3.2", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^5.0.1" | ||
}, | ||
@@ -59,0 +60,0 @@ "testling": { |
@@ -15,2 +15,4 @@ 'use strict'; | ||
t['throws'](function () { fromEntries(null); }, 'entries throws on null'); | ||
t.deepEqual(fromEntries([['foo', 1], ['foo', 2]]), { foo: 2 }, 'works with a duplicate key'); | ||
}; |
Sorry, the diff of this file is not supported yet
17673
23
9
123
+ Addedcall-bind@^1.0.0
- Removedfunction-bind@^1.1.1
Updatedes-abstract@^1.18.0-next.1