Name: Array.prototype.every
Owner: ECMAScript Shims
Description: Array.prototype.every spec-compliant polyfill
Forked from: ljharb/Array.prototype.every
Created: 2016-11-23 01:45:33.0
Updated: 2016-11-23 01:45:34.0
Pushed: 2016-11-23 01:45:21.0
Homepage: https://tc39.github.io/ecma262/#sec-array.prototype.every
Size: 198
Language: HTML
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
An ES5 spec-compliant Array.prototype.every
shim/polyfill/replacement that works as far down as ES3.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the proposed spec.
Because Array.prototype.every
depends on a receiver (the ?this? value), the main export takes the array to operate on as the first argument.
every = require('array.prototype.every');
assert = require('assert');
rt.equal(true, every([1, 1, 1], function (x) { return x === 1; }));
rt.equal(false, every([1, 0, 1], function (x) { return x === 1; }));
s
every = require('array.prototype.every');
assert = require('assert');
hen Array#every is not present */
te Array.prototype.every;
shimmedEvery = every.shim();
rt.equal(shimmedEvery, every.getPolyfill());
arr = [1, 2, 3];
lessThan4 = function (x) { return x < 4; };
rt.deepEqual(arr.every(lessThan4), every(arr, lessThan4));
s
every = require('array.prototype.every');
assert = require('assert');
hen Array#every is present */
shimmedEvery = every.shim();
rt.equal(shimmedEvery, Array.prototype.every);
rt.deepEqual(arr.every(lessThan4), every(arr, lessThan4));
Simply clone the repo, npm install
, and run npm test