Official ES proposal-compliant polyfill for Object.fromEntries
Branch: master
Clone or download
Latest commit 511f215 Aug 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test [Breaking] throw when `iterable` is nullish Aug 9, 2018
.eslintrc [Breaking] throw when `iterable` is nullish Aug 9, 2018
.gitignore Only apps should have lockfiles Mar 21, 2018
.npmrc Only apps should have lockfiles Mar 21, 2018
.travis.yml Tests Mar 21, 2018
CHANGELOG.md v2.0.0 Aug 9, 2018
LICENSE Initial commit Mar 21, 2018
README.md
auto.js Implementation. Mar 21, 2018
implementation.js [Breaking] throw when `iterable` is nullish Aug 9, 2018
index.js Implementation. Mar 21, 2018
package.json v2.0.0 Aug 9, 2018
polyfill.js
shim.js

README.md

object.fromentries Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

browser support

An ES spec-proposal-compliant Object.fromEntries shim. Invoke its "shim" method to shim Object.fromEntries if it is unavailable or noncompliant.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the proposed spec.

Most common usage:

var assert = require('assert');
var fromEntries = require('object.fromentries');

var obj = { a: 1, b: 2, c: 3 };
var actual = fromEntries(Object.entries(obj));

assert.deepEqual(obj, actual);

if (!Object.fromEntries) {
	fromEntries.shim();
}

assert.deepEqual(Object.fromEntries(Object.entries(obj)), obj);

Tests

Simply clone the repo, npm install, and run npm test