UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

52 lines 963 B
//#region src/map/hasAll.d.ts /** * `hasAll(map, keys)` * * Checks if `map` contains all of the specified `keys`. This function supports iterables. * * ```ts * hasAll( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * ["a", "b"], * ); // true * * hasAll( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * ["a", "d"], * ); // false * ``` * * ```ts * pipe( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * hasAll(["a", "b"]), * ); // true * * pipe( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * hasAll(["a", "d"]), * ); // false * ``` */ declare const hasAll: { <K, V>(keys: Iterable<NoInfer<K>>): (target: ReadonlyMap<K, V>) => boolean; <K, V>(target: ReadonlyMap<K, V>, keys: Iterable<NoInfer<K>>): boolean; }; //#endregion export { hasAll };