Package: effect
Module: HashMap
Returns an IterableIterator of the entries within the HashMap.
Example (Iterating entries)
import { HashMap } from "effect"
// Create a configuration map
const config = HashMap.make(
["database.host", "localhost"],
["database.port", "5432"],
["cache.enabled", "true"]
)
// Sort the derived array for deterministic output
const settings = Array.from(HashMap.entries(config))
.sort(([left], [right]) => left.localeCompare(right))
.map(([key, value]) => `Setting ${key} = ${value}`)
console.log(settings)
// ["Setting cache.enabled = true", "Setting database.host = localhost", "Setting database.port = 5432"]
// Convert to array when you need all entries at once
const allEntries = Array.from(HashMap.entries(config))
console.log(allEntries.length) // 3
Signature
declare const entries: <K, V>(self: HashMap<K, V>) => IterableIterator<[K, V]>
Since v2.0.0