Hyperlinkv0.8.0-beta.28

HashMap

HashMap.getconsteffect/HashMap.ts:332
<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>

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)
elements
Source effect/HashMap.ts:3324 lines
export 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>
} = internal.get
Referenced by 6 symbols