array.prototype.find
Array.prototype.find ES6 polyfill.
Last updated 7 years ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install array.prototype.find 
SYNC missed versions from official npm registry.

array.prototype.find Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Simple ES6 Array.prototype.find polyfill for older environments taken from es6-shim.

For browsers and node.js.

Installation

  • Just include repo before your scripts.
  • npm install array.prototype.find

Usage

  • Array.prototype.find(predicate[, thisArg]) returns first item that matches predicate function.
  • predicate(value, index, collection): takes three arguments
    • value: current collection element
    • index: current collection element index
    • collection: 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

Acknowledgements

Tests, fixes, and travis support added by _duncanhall

License

The MIT License (c) 2016 Paul Miller (http://paulmillr.com)

Current Tags

  • 2.2.3                                ...           latest (2 years ago)

15 Versions

  • 2.2.3                                ...           2 years ago
  • 2.2.2                                ...           3 years ago
  • 2.2.1                                ...           3 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.2                                ...           5 years ago
  • 2.1.1                                ...           6 years ago
  • 2.1.0                                ...           7 years ago
  • 2.0.4                                ...           9 years ago
  • 2.0.3                                ...           9 years ago
  • 2.0.2                                ...           9 years ago
  • 2.0.1                                ...           9 years ago
  • 2.0.0                                ...           10 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (2)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 5
Dependencies (2)
Dev Dependencies (5)

Copyright 2013 - present © cnpmjs.org | Home |