UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

54 lines 1.27 kB
//#region src/map/removeAll.d.ts /** * `removeAll(map, keys)` * * Removes all entries with the specified `keys` from `map`, returning a new map. This function supports iterables. * * ```ts * removeAll( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * ["a", "c"], * ); // Map(1) { "b" => 2 } * * removeAll( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * ["d", "e"], * ); // Map(3) { "a" => 1, "b" => 2, "c" => 3 } * ``` * * ```ts * pipe( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * removeAll(["a", "c"]), * ); // Map(1) { "b" => 2 } * * pipe( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * removeAll(["d", "e"]), * ); // Map(3) { "a" => 1, "b" => 2, "c" => 3 } * ``` */ declare const removeAll: { <K, V>(keys: Iterable<NoInfer<K>>): (target: Map<K, V>) => Map<K, V>; <K, V>(keys: Iterable<NoInfer<K>>): (target: ReadonlyMap<K, V>) => ReadonlyMap<K, V>; <K, V>(target: Map<K, V>, keys: Iterable<NoInfer<K>>): Map<K, V>; <K, V>(target: ReadonlyMap<K, V>, keys: Iterable<NoInfer<K>>): ReadonlyMap<K, V>; }; //#endregion export { removeAll };