Name: Array.prototype.some
Owner: ECMAScript Shims
Description: Array.prototype.some spec-compliant polyfill
Forked from: ljharb/Array.prototype.some
Created: 2016-11-23 15:52:56.0
Updated: 2016-11-23 15:52:57.0
Pushed: 2016-11-23 15:52:48.0
Homepage: https://tc39.github.io/ecma262/#sec-array.prototype.some
Size: 199
Language: HTML
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
An ES5 spec-compliant Array.prototype.some
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.some
depends on a receiver (the ?this? value), the main export takes the array to operate on as the first argument.
some = require('array.prototype.some');
assert = require('assert');
rt.equal(true, some([1, 2, 3], function (x) { return x === 2; }));
rt.equal(false, some([1, 2, 3], function (x) { return x === 4; }));
s
some = require('array.prototype.some');
assert = require('assert');
hen Array#some is not present */
te Array.prototype.some;
shimmedSome = some.shim();
rt.equal(shimmedSome, some.getPolyfill());
arr = [1, 2, 3];
threeOrLarger = function (x) { return x >= 3; };
rt.deepEqual(arr.some(threeOrLarger), some(arr, threeOrLarger));
s
some = require('array.prototype.some');
assert = require('assert');
hen Array#some is present */
shimmedSome = some.shim();
rt.equal(shimmedSome, Array.prototype.some);
rt.deepEqual(arr.some(threeOrLarger), some(arr, threeOrLarger));
Simply clone the repo, npm install
, and run npm test