MCPcopy Create free account
hub / github.com/RubyLouvre/anu / baseFindIndex

Function baseFindIndex

test/babel.js:21727–21737  ·  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 from.

(array, predicate, fromIndex, fromRight)

Source from the content-addressed store, hash-verified

21725 * @returns {number} Returns the index of the matched value, else `-1`.
21726 */
21727 function baseFindIndex(array, predicate, fromIndex, fromRight) {
21728 var length = array.length,
21729 index = fromIndex + (fromRight ? 1 : -1);
21730
21731 while (fromRight ? index-- : ++index < length) {
21732 if (predicate(array[index], index, array)) {
21733 return index;
21734 }
21735 }
21736 return -1;
21737 }
21738
21739 module.exports = baseFindIndex;
21740

Callers 3

baseIndexOfFunction · 0.85
findIndexFunction · 0.85
findLastIndexFunction · 0.85

Calls 1

predicateFunction · 0.85

Tested by

no test coverage detected