Hyperlinkv0.8.0-beta.28

MutableHashMap

MutableHashMap.keysconsteffect/MutableHashMap.ts:329
<K, V>(self: MutableHashMap<K, V>): Iterable<K>

Returns an iterable over the keys in the MutableHashMap.

When to use

Use to iterate over the keys currently stored in a mutable hash map.

Example (Reading keys)

import { MutableHashMap } from "effect"

const map = MutableHashMap.make(
  ["apple", 1],
  ["banana", 2],
  ["cherry", 3]
)

const allKeys = Array.from(MutableHashMap.keys(map))
console.log(allKeys) // ["apple", "banana", "cherry"]

// Useful for iteration or validation
const hasRequiredKeys = allKeys.includes("apple") && allKeys.includes("banana")
elementsvalueshas
export const keys = <K, V>(self: MutableHashMap<K, V>): Iterable<K> => self.backing.keys()
Referenced by 2 symbols