UNPKG

find-index

Version:

finds an item in an array matching a predicate function, and returns its index

9 lines (8 loc) 267 B
// Use the native ES6 `Array.findIndex` if available. if (typeof Array.prototype.findIndex === 'function') { module.exports = function (array, predicate, self) { return array.findIndex(predicate, self); } } else { module.exports = require('./findIndex'); }