Polyfill for the The find() method. Returns a value in the array, if an element in the array satisfies the provided testing function. Otherwise undefined is returned
Switch branches/tags
Nothing to show
Clone or download
Latest commit 17a804c Apr 16, 2016
Permalink
Failed to load latest commit information.
.editorconfig Add editor rules Apr 10, 2016
.gitignore Update ignore of files, directories Apr 10, 2016
.travis.yml Add .travis config Apr 16, 2016
find.js Update package name Apr 10, 2016
package.json 0.1.3 Apr 16, 2016
readme.md Update readme Apr 16, 2016
test.js Add tests Apr 10, 2016

readme.md

Array.prototype.find ES6 polyfill for ES5 versions and lower.

Array.prototype.find ES6 polyfill for ES5 versions and lower via NPM, you only need to require the module in order to have it working in order to use knowing that is going to work in browsers that does not support this function natively.

Build Status - Based from Mozilla polyfill.

Installation.

  1. Require the npm module.
npm install --save-dev jspolyfill-array.prototype.find
  1. Include the file before the usage.

Then you need to require the file on your main.js or where you are going to plan to use the find function as follows:

require("jspolyfill-array.prototype.find")

Usage

arr.find(callback[, thisArg])

Where arr is your array.

  • callback Function to execute on each value in the array, taking three arguments:
    • element The current element being processed in the array.
    • index The index of the current element being processed in the array.
    • array The array find was called upon.
  • thisArg Optional. Object to use as this when executing callback.

The callback passed as a parameter inside of the find function is fired every time per each element inside of the array until finds an element where the callback evaluates to true.

It returns the first match if no match is found it will return undefined.

For more information click here.