MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / baseFindIndex

Function baseFindIndex

lib/web/jshint.js:1805–1815  ·  view source on GitHub ↗

* The base implementation of `_.findIndex` and `_.findLastIndex` without * support for callback shorthands and `this` binding. * * @private * @param {Array} array The array to search. * @param {Function} predicate The function invoked per iteration. * @param {boolean} [fromRight] S

(array, predicate, fromRight)

Source from the content-addressed store, hash-verified

1803 * @returns {number} Returns the index of the matched value, else `-1`.
1804 */
1805 function baseFindIndex(array, predicate, fromRight) {
1806 var length = array.length,
1807 index = fromRight ? length : -1;
1808
1809 while ((fromRight ? index-- : ++index < length)) {
1810 if (predicate(array[index], index, array)) {
1811 return index;
1812 }
1813 }
1814 return -1;
1815 }
1816
1817 /**
1818 * The base implementation of `_.indexOf` without support for binary searches.

Callers 2

createFindFunction · 0.85
createFindIndexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected