effect-io-ai

Package: effect
Module: MutableHashMap

MutableHashMap.keys

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")

See

Signature

declare const keys: <K, V>(self: MutableHashMap<K, V>) => Iterable<K>

Source

Since v3.8.0