UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

23 lines 694 B
//#region src/compat/array/lastIndexOf.d.ts /** * Gets the index at which the last occurrence of value is found in array. * * @template T * @param array - The array to inspect. * @param value - The value to search for. * @param [fromIndex] - The index to search from or true to search from the end. * @returns Returns the index of the matched value, else -1. * * @example * lastIndexOf([1, 2, 1, 2], 2); * // => 3 * * lastIndexOf([1, 2, 1, 2], 2, 2); * // => 1 * * lastIndexOf([1, 2, 1, 2], 2, true); * // => 1 */ declare function lastIndexOf<T>(array: ArrayLike<T> | null | undefined, searchElement: T, fromIndex?: true | number): number; //#endregion export { lastIndexOf };