MCPcopy
hub / github.com/lodash/lodash / findLastIndex

Function findLastIndex

lodash.js:7391–7404  ·  lodash.js::findLastIndex

* This method is like `_.findIndex` except that it iterates over elements * of `collection` from right to left. * * @static * @memberOf _ * @since 2.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [predicate=_.identity] T

(array, predicate, fromIndex)

Source from the content-addressed store, hash-verified

7389 * class="cm">// => 0
7390 */
7391 function findLastIndex(array, predicate, fromIndex) {
7392 var length = array == null ? 0 : array.length;
7393 if (!length) {
7394 return -1;
7395 }
7396 var index = length - 1;
7397 if (fromIndex !== undefined) {
7398 index = toInteger(fromIndex);
7399 index = fromIndex < 0
7400 ? nativeMax(length + index, 0)
7401 : nativeMin(index, length - 1);
7402 }
7403 return baseFindIndex(array, getIteratee(predicate, 3), index, true);
7404 }
7405
7406 /**
7407 * Flattens `array` a single level deep.

Callers

nothing calls this directly

Calls 3

toIntegerFunction · 0.85
baseFindIndexFunction · 0.85
getIterateeFunction · 0.85

Tested by

no test coverage detected