https://github.com/vovkabelov/array.findindex
Lightweight Array.prototype.findIndex Polyfill. ES5. IE9+
https://github.com/vovkabelov/array.findindex
array es5 findindex ie9 javascript polyfill
Last synced: 12 months ago
JSON representation
Lightweight Array.prototype.findIndex Polyfill. ES5. IE9+
- Host: GitHub
- URL: https://github.com/vovkabelov/array.findindex
- Owner: vovkabelov
- License: mit
- Created: 2017-11-14T19:34:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-24T20:00:21.000Z (over 8 years ago)
- Last Synced: 2025-07-13T07:51:57.191Z (about 1 year ago)
- Topics: array, es5, findindex, ie9, javascript, polyfill
- Language: JavaScript
- Homepage: https://vovkabelov.github.io/array.findIndex
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lightweight Array.prototype.findIndex polyfill
[](https://travis-ci.org/vovkabelov/array.findIndex)
[](https://coveralls.io/github/vovkabelov/array.findIndex?branch=master&service=Github)
[](https://codeclimate.com/github/vovkabelov/array.findIndex/maintainability)
[](https://raw.githubusercontent.com/vovkabelov/array.findIndex/master/dist/array-find-index-polyfill.min.js)
[](https://badge.fury.io/js/array.findindex)
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](https://github.com/vovkabelov/array.findIndex/archive/master.zip) or install with bower
`bower install array.findindex`
**2.** Include polyfill on your web-page
```html
```
**3.** Use as native method
```javascript
["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](https://jsperf.com/array-prototype-find-index-polyfill)
## Links
[Specification](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.findindex) on "Ecma International"
[MDN examples](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex)
## Copyright and license
Code and documentation copyright 2017 Vladimir Belov. Code released under the [MIT license](https://github.com/vovkabelov/array.find/blob/master/LICENSE).