UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

50 lines (48 loc) 680 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/map/has.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 * ``` */ const has = dfdlT((target, key) => { return target.has(key); }, 2); //#endregion export { has };