@naverpay/hidash
Version:
improved lodash
19 lines (16 loc) • 863 B
text/typescript
import { ListIterateeCustom } from './internal/baseIteratee.type.mjs';
import './internal/types.mjs';
/**
* @description
* Finds the **last index** of an element in an array that satisfies a given predicate.
* If no element satisfies the predicate, it returns `-1`.
*
* Opposed to `findIndex`, this function starts searching from the end of the array.
*
* @param {Array<T>} array The array to search
* @param {ListIterateeCustom<T, unknown>} [predicate] The function invoked per iteration
* @param {number} [fromIndex] The index to search from (default: `array.length - 1`)
* @returns {number} The index of the last element that satisfies the predicate, or `-1` if none found
*/
declare function findLastIndex<T>(array: T[], predicate?: ListIterateeCustom<T, unknown>, fromIndex?: number): number;
export { findLastIndex as default, findLastIndex };