UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

25 lines (23 loc) 1.02 kB
import { IsLiteral } from "../internals/types.js"; //#region src/array/removeAll.d.ts /** * `removeAll(target, values)` * * Removes all occurrences of each value in `values` from `target` array. If no values are found, returns the original array unchanged. Supports iterables for the values parameter. * * ```ts * removeAll([1, 2, 3, 2, 4], [2, 4]); // [1, 3] * ``` * * ```ts * pipe([1, 2, 3, 2, 4], removeAll([2, 4])); // [1, 3] * ``` */ declare const removeAll: { <T, const U extends T>(values: Iterable<U>): (target: T[]) => IsLiteral<U> extends true ? Exclude<T, U>[] : T[]; <T, const U extends T>(values: Iterable<U>): (target: readonly T[]) => IsLiteral<U> extends true ? readonly Exclude<T, U>[] : readonly T[]; <T, const U extends T>(target: T[], values: Iterable<U>): IsLiteral<U> extends true ? Exclude<T, U>[] : T[]; <T, const U extends T>(target: readonly T[], values: Iterable<U>): IsLiteral<U> extends true ? readonly Exclude<T, U>[] : readonly T[]; }; //#endregion export { removeAll };