MCPcopy
hub / github.com/lodash/lodash / baseFindIndex

Function baseFindIndex

lodash.js:812–822  ·  view source on GitHub ↗

* The base implementation of `_.findIndex` and `_.findLastIndex` without * support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} predicate The function invoked per iteration. * @param {number} fromIndex The index to search fr

(array, predicate, fromIndex, fromRight)

Source from the content-addressed store, hash-verified

810 * @returns {number} Returns the index of the matched value, else `-1`.
811 */
812 function baseFindIndex(array, predicate, fromIndex, fromRight) {
813 var length = array.length,
814 index = fromIndex + (fromRight ? 1 : -1);
815
816 while ((fromRight ? index-- : ++index < length)) {
817 if (predicate(array[index], index, array)) {
818 return index;
819 }
820 }
821 return -1;
822 }
823
824 /**
825 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.

Callers 4

baseIndexOfFunction · 0.85
findIndexFunction · 0.85
findLastIndexFunction · 0.85
lastIndexOfFunction · 0.85

Calls 1

predicateFunction · 0.50

Tested by

no test coverage detected