source: node_modules/es-toolkit/dist/compat/array/findLastIndex.d.mts@ ba17441

Last change on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.1 KB
Line 
1import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs';
2
3/**
4 * Finds the index of the last element in the array that satisfies the predicate.
5 *
6 * @template T
7 * @param {ArrayLike<T> | null | undefined} array - The array to search through.
8 * @param {ListIterateeCustom<T, boolean>} [predicate] - The predicate function, partial object, property-value pair, or property name.
9 * @param {number} [fromIndex] - The index to start searching from.
10 * @returns {number} The index of the last matching element, or -1 if not found.
11 *
12 * @example
13 * const users = [
14 * { user: 'barney', active: true },
15 * { user: 'fred', active: false },
16 * { user: 'pebbles', active: false }
17 * ];
18 *
19 * findLastIndex(users, o => o.user === 'pebbles');
20 * // => 2
21 *
22 * findLastIndex(users, { user: 'barney', active: true });
23 * // => 0
24 *
25 * findLastIndex(users, ['active', false]);
26 * // => 2
27 *
28 * findLastIndex(users, 'active');
29 * // => 0
30 */
31declare function findLastIndex<T>(array: ArrayLike<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
32
33export { findLastIndex };
Note: See TracBrowser for help on using the repository browser.