![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | tests/ | 2 years ago | - | |
![]() | CHANGELOG.md | 39 years ago | 2.0K | |
![]() | LICENSE | 39 years ago | 1.1K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | README.md | 39 years ago | 1.3K | f12eb36 documentaiton updates [كارل مبارك] |
![]() | auto.js | 39 years ago | 36 | |
![]() | implementation.js | 39 years ago | 740 | |
![]() | index.js | 39 years ago | 665 | |
![]() | package.json | 2 years ago | 2.2K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | polyfill.js | 39 years ago | 428 | |
![]() | shim.js | 39 years ago | 330 |
Array.prototype.find
polyfillSimple ES6 Array.prototype.find polyfill for older environments taken from es6-shim.
For browsers and node.js.
npm install array.prototype.find
Array.prototype.find(predicate[, thisArg])
returns first item that matches predicate
function.predicate(value, index, collection)
: takes three argumentsvalue
: current collection elementindex
: current collection element indexcollection
: the collection// as a function
var find = require('array.prototype.find');
find([1, 2], function (x) { return x === 2; }); // 2
// to shim it
require('array.prototype.find').shim();
Code example:
// Default:
[1, 5, 10, 15].find(function (a) { return a > 9; }) // 10
Tests, fixes and travis support added by _duncanhall
The MIT License (c) 2016 Paul Miller (http://paulmillr.com)