effect-io-ai

Package: effect
Module: HashMap

HashMap.hasBy

Checks whether an element matching the given predicate exists in the given HashMap.

Example (Checking entries by predicate)

import { HashMap } from "effect"

const hm = HashMap.make([1, "a"])
HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
HashMap.hasBy(hm, (value) => value === "b") // -> false

Signature

declare const hasBy: { <K, V>(predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean): (self: HashMap<K, V>) => boolean; <K, V>(self: HashMap<K, V>, predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean): boolean; }

Source

Since v3.16.0