@monstermann/fn
Version:
A utility library for TypeScript.
48 lines • 762 B
TypeScript
//#region src/map/has.d.ts
/**
* `has(map, key)`
*
* Checks if `map` contains the specified `key`.
*
* ```ts
* has(
* new Map([
* ["a", 1],
* ["b", 2],
* ]),
* "a",
* ); // true
*
* has(
* new Map([
* ["a", 1],
* ["b", 2],
* ]),
* "c",
* ); // false
* ```
*
* ```ts
* pipe(
* new Map([
* ["a", 1],
* ["b", 2],
* ]),
* has("a"),
* ); // true
*
* pipe(
* new Map([
* ["a", 1],
* ["b", 2],
* ]),
* has("c"),
* ); // false
* ```
*/
declare const has: {
<K, V>(key: NoInfer<K>): (target: ReadonlyMap<K, V>) => boolean;
<K, V>(target: ReadonlyMap<K, V>, key: NoInfer<K>): boolean;
};
//#endregion
export { has };