source: node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.ts@ a762898

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

Added visualizations

  • Property mode set to 100644
File size: 1.1 KB
Line 
1import { ListIteratee } from '../_internal/ListIteratee.js';
2
3/**
4 * Creates a slice of array with elements taken from the end. Elements are taken until predicate
5 * returns falsey. The predicate is invoked with three arguments: (value, index, array).
6 *
7 * @template T
8 * @param {ArrayLike<T> | null | undefined} array - The array to query.
9 * @param {ListIteratee<T>} [predicate] - The function invoked per iteration.
10 * @returns {T[]} Returns the slice of array.
11 *
12 * @example
13 * const users = [
14 * { 'user': 'barney', 'active': true },
15 * { 'user': 'fred', 'active': false },
16 * { 'user': 'pebbles', 'active': false }
17 * ];
18 *
19 * takeRightWhile(users, function(o) { return !o.active; });
20 * // => objects for ['fred', 'pebbles']
21 *
22 * @example
23 * takeRightWhile(users, { 'user': 'pebbles', 'active': false });
24 * // => objects for ['pebbles']
25 *
26 * @example
27 * takeRightWhile(users, ['active', false]);
28 * // => objects for ['fred', 'pebbles']
29 *
30 * @example
31 * takeRightWhile(users, 'active');
32 * // => []
33 */
34declare function takeRightWhile<T>(array: ArrayLike<T> | null | undefined, predicate?: ListIteratee<T>): T[];
35
36export { takeRightWhile };
Note: See TracBrowser for help on using the repository browser.