@naverpay/hidash
Version:
improved lodash
19 lines (16 loc) • 847 B
TypeScript
import { ListIterateeCustom } from './internal/baseIteratee.type.js';
import './internal/types.js';
/**
* @description
* Finds the **index** of the first element in an array that satisfies a given predicate.
* If no element satisfies the predicate, it returns `-1`.
*
* Opposed to `findLastIndex`, this function starts searching from the beginning 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: `0`)
* @returns {number} The index of the first element that satisfies the predicate, or `-1` if none found
*/
declare function findIndex<T>(array: T[], predicate?: ListIterateeCustom<T, unknown>, fromIndex?: number): number;
export { findIndex as default, findIndex };