source: node_modules/es-toolkit/dist/array/remove.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: 773 bytes
Line 
1/**
2 * Removes elements from an array based on a predicate function.
3 *
4 * This function changes `arr` in place.
5 * If you want to remove elements without modifying the original array, use `filter`.
6 *
7 * @template T
8 * @param {T[]} arr - The array to modify.
9 * @param {(value: T, index: number, array: T[]) => boolean} shouldRemoveElement - The function invoked per iteration to determine if an element should be removed.
10 * @returns {T[]} The modified array with the specified elements removed.
11 *
12 * @example
13 * const numbers = [1, 2, 3, 4, 5];
14 * remove(numbers, (value) => value % 2 === 0);
15 * console.log(numbers); // [1, 3, 5]
16 */
17declare function remove<T>(arr: T[], shouldRemoveElement: (value: T, index: number, array: T[]) => boolean): T[];
18
19export { remove };
Note: See TracBrowser for help on using the repository browser.