effect-io-ai

Package: effect
Module: HashMap

HashMap.has

Checks whether the specified key has an entry in the HashMap.

Example (Checking for keys)

import { HashMap } from "effect"

const map = HashMap.make(["a", 1], ["b", 2])

console.log(HashMap.has(map, "a")) // true
console.log(HashMap.has(map, "c")) // false

// Using pipe syntax
const hasB = HashMap.has("b")(map)
console.log(hasB) // true

Signature

declare const has: { <K1 extends K, K>(key: K1): <K, V>(self: HashMap<K, V>) => boolean; <K1 extends K, K, V>(self: HashMap<K, V>, key: K1): boolean; }

Source

Since v2.0.0