Hyperlinkv0.8.0-beta.28

HashMap

HashMap.hasByconsteffect/HashMap.ts:496
<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

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
elements
Source effect/HashMap.ts:4964 lines
export 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
} = internal.hasBy
Referenced by 1 symbols