effect-io-ai

Package: effect
Module: HashSet

HashSet.every

Checks whether all values in the HashSet satisfy the predicate.

Example (Testing whether every value matches)

import { HashSet } from "effect"

const numbers = HashSet.make(2, 4, 6, 8)

console.log(HashSet.every(numbers, (n) => n % 2 === 0)) // true
console.log(HashSet.every(numbers, (n) => n > 5)) // false

const empty = HashSet.empty<number>()
console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)

Signature

declare const every: { <V>(predicate: Predicate<V>): (self: HashSet<V>) => boolean; <V>(self: HashSet<V>, predicate: Predicate<V>): boolean; }

Source

Since v2.0.0