Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

vovkabelov/array.findIndex

Open more actions menu

Repository files navigation

Lightweight Array.prototype.findIndex polyfill

Build Status Coverage Status Maintainability Size npm version

The findIndex() method returns the index of the first element in the array that satisfies the provided testing function. Otherwise -1 is returned.

How It Works

1. Download Latest version or install with bower bower install array.findindex
2. Include polyfill on your web-page

<script src="dist/array-find-index-polyfill.min.js"></script>

3. Use as native method

["apple", "banana", "peach"].findIndex(function(item) {
    return item === "banana";
});
// 1

Performance

Testing in Chrome 61.0.3163 / Mac OS X 10.13.0
Native 431,077 Ops/sec
Polyfill 2,289,661 Ops/sec

See https://jsperf.com/array-prototype-find-index-polyfill

Links

Specification on "Ecma International"
MDN examples

Copyright and license

Code and documentation copyright 2017 Vladimir Belov. Code released under the MIT license.

About

Lightweight Array.prototype.findIndex Polyfill. ES5. IE9+

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.