effect-io-ai

Package: effect
Module: MutableHashMap

MutableHashMap.has

Checks whether the MutableHashMap contains the specified key.

When to use

Use to test whether a key is present in a MutableHashMap without reading its value.

Example (Checking for a key)

import { MutableHashMap } from "effect"

const map = MutableHashMap.make(["key1", 42], ["key2", 100])

console.log(MutableHashMap.has(map, "key1")) // true
console.log(MutableHashMap.has(map, "key3")) // false

// Pipe-able version
const hasKey = MutableHashMap.has("key1")
console.log(hasKey(map)) // true

See

Signature

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

Source

Since v2.0.0