source: node_modules/es-toolkit/dist/array/dropWhile.d.mts

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.0 KB
Line 
1/**
2 * Removes elements from the beginning of an array until the predicate returns false.
3 *
4 * This function iterates over an array and drops elements from the start until the provided
5 * predicate function returns false. It then returns a new array with the remaining elements.
6 *
7 * @template T - The type of elements in the array.
8 * @param {T[]} arr - The array from which to drop elements.
9 * @param {(item: T, index: number, arr: T[]) => boolean} canContinueDropping - A predicate function that determines
10 * whether to continue dropping elements. The function is called with each element, and dropping
11 * continues as long as it returns true.
12 * @returns {T[]} A new array with the elements remaining after the predicate returns false.
13 *
14 * @example
15 * const array = [1, 2, 3, 4, 5];
16 * const result = dropWhile(array, x => x < 3);
17 * // result will be [3, 4, 5] since elements less than 3 are dropped.
18 */
19declare function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T, index: number, arr: readonly T[]) => boolean): T[];
20
21export { dropWhile };
Note: See TracBrowser for help on using the repository browser.