source: node_modules/es-toolkit/dist/compat/array/remove.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: 852 bytes
Line 
1import { ListIteratee } from '../_internal/ListIteratee.js';
2import { MutableList } from '../_internal/MutableList.d.js';
3import { RejectReadonly } from '../_internal/RejectReadonly.d.js';
4
5/**
6 * Removes all elements from array that predicate returns truthy for and returns an array of the removed elements.
7 *
8 * @template L
9 * @param {RejectReadonly<L>} array - The array to modify.
10 * @param {ListIteratee<L[0]>} [predicate] - The function invoked per iteration.
11 * @returns {Array<L[0]>} Returns the new array of removed elements.
12 *
13 * @example
14 * const array = [1, 2, 3, 4];
15 * const evens = remove(array, n => n % 2 === 0);
16 * console.log(array); // => [1, 3]
17 * console.log(evens); // => [2, 4]
18 */
19declare function remove<L extends MutableList<any>>(array: RejectReadonly<L>, predicate?: ListIteratee<L[0]>): Array<L[0]>;
20
21export { remove };
Note: See TracBrowser for help on using the repository browser.