effect-io-ai

Package: effect
Module: HashMap

HashMap.get

Looks up the value for the specified key in the HashMap safely using the internal hashing function.

Example (Looking up values)

import { HashMap } from "effect"

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

console.log(HashMap.get(map, "a")) // Option.some(1)
console.log(HashMap.get(map, "c")) // Option.none()

// Using pipe syntax
const value = HashMap.get("b")(map)
console.log(value) // Option.some(2)

Signature

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

Source

Since v2.0.0