HashMap is an immutable hash-based map data structure.
Type Definition
Constructors
empty
Creates an emptyHashMap.
make
Creates aHashMap from entries.
fromIterable
Creates aHashMap from an iterable of key-value pairs.
Learn more about Mintlify
Enter your email to receive updates about new features and product releases.
API reference for the HashMap immutable map type
HashMap is an immutable hash-based map data structure.
interface HashMap<K, V> extends Iterable<[K, V]>
HashMap.
const empty: <K = never, V = never>() => HashMap<K, V>
HashMap from entries.
const make: <Entries extends ReadonlyArray<readonly [any, any]>>(...entries: Entries) => HashMap<Entries[number][0], Entries[number][1]>
HashMap from an iterable of key-value pairs.
const fromIterable: <K, V>(iterable: Iterable<readonly [K, V]>) => HashMap<K, V>
const set: <K, V>(key: K, value: V) => (self: HashMap<K, V>) => HashMap<K, V>
const get: <K>(key: K) => <V>(self: HashMap<K, V>) => Option<V>
const remove: <K>(key: K) => <V>(self: HashMap<K, V>) => HashMap<K, V>
import { HashMap } from "effect"
const map = HashMap.make(["a", 1], ["b", 2]).pipe(
HashMap.set("c", 3)
)
console.log(HashMap.get(map, "b")) // Some(2)