source: node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.ts

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

Added visualizations

  • Property mode set to 100644
File size: 1.3 KB
Line 
1import { ListIteratee } from '../_internal/ListIteratee.js';
2
3/**
4 * Creates a slice of array excluding elements dropped from the end until predicate returns falsey.
5 * The predicate is invoked with three arguments: (value, index, array).
6 *
7 * @template T - The type of elements in the array.
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 * @example
12 *
13 * const users = [
14 * { user: 'barney', active: true },
15 * { user: 'fred', active: false },
16 * { user: 'pebbles', active: false }
17 * ];
18 *
19 * // Using function predicate
20 * dropRightWhile(users, user => !user.active);
21 * // => [{ user: 'barney', active: true }]
22 *
23 * // Using matches shorthand
24 * dropRightWhile(users, { user: 'pebbles', active: false });
25 * // => [{ user: 'barney', active: true }, { user: 'fred', active: false }]
26 *
27 * // Using matchesProperty shorthand
28 * dropRightWhile(users, ['active', false]);
29 * // => [{ user: 'barney', active: true }]
30 *
31 * // Using property shorthand
32 * dropRightWhile(users, 'active');
33 * // => [{ user: 'barney', active: true }]
34 */
35declare function dropRightWhile<T>(array: ArrayLike<T> | null | undefined, predicate?: ListIteratee<T>): T[];
36
37export { dropRightWhile };
Note: See TracBrowser for help on using the repository browser.