Yang Guo | 4fd355c | 2019-09-19 08:59:03 | [diff] [blame] | 1 | # array-find-index [](https://travis-ci.org/sindresorhus/array-find-index) |
| 2 | |
| 3 | > ES2015 [`Array#findIndex()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) [ponyfill](https://ponyfill.com) |
| 4 | |
| 5 | |
| 6 | ## Install |
| 7 | |
| 8 | ``` |
| 9 | $ npm install --save array-find-index |
| 10 | ``` |
| 11 | |
| 12 | |
| 13 | ## Usage |
| 14 | |
| 15 | ```js |
| 16 | const arrayFindIndex = require('array-find-index'); |
| 17 | |
| 18 | arrayFindIndex(['rainbow', 'unicorn', 'pony'], x => x === 'unicorn'); |
| 19 | //=> 1 |
| 20 | ``` |
| 21 | |
| 22 | |
| 23 | ## API |
| 24 | |
| 25 | Same as `Array#findIndex()`, but with the input array as the first argument. |
| 26 | |
| 27 | |
| 28 | ## License |
| 29 | |
| 30 | MIT © [Sindre Sorhus](https://sindresorhus.com) |