12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- var baseFindIndex = require('./_baseFindIndex'),
- baseIteratee = require('./_baseIteratee'),
- toInteger = require('./toInteger');
-
-
- var nativeMax = Math.max;
-
-
- function findIndex(array, predicate, fromIndex) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return -1;
- }
- var index = fromIndex == null ? 0 : toInteger(fromIndex);
- if (index < 0) {
- index = nativeMax(length + index, 0);
- }
- return baseFindIndex(array, baseIteratee(predicate, 3), index);
- }
-
- module.exports = findIndex;
|