UNPKG

super-utils-plus

Version:

A superior alternative to Lodash with improved performance, TypeScript support, and developer experience

24 lines (23 loc) 614 B
/** * Removes all elements from array that predicate returns truthy for * and returns an array of the removed elements. * * @param array - The array to modify * @param predicate - The function invoked per iteration * @returns Returns the new array of removed elements * * @example * ```ts * const array = [1, 2, 3, 4]; * const evens = remove(array, function(n) { * return n % 2 === 0; * }); * * console.log(array); * // => [1, 3] * * console.log(evens); * // => [2, 4] * ``` */ export declare function remove<T>(array: T[], predicate: (value: T, index: number, array: T[]) => boolean): T[];