effect-io-ai

Package: effect
Module: Predicate

Predicate.every

Creates a predicate that returns true if all predicates in the collection return true.

When to use

Use when you have a dynamic list of predicates to apply.

Details

Evaluation short-circuits on the first false. The collection is iterated each time the predicate is called.

Example (Checking all predicates)

import { Predicate } from "effect"

const allChecks = Predicate.every([Predicate.isNumber, (n: number) => n > 0])

console.log(allChecks(2))

See

Signature

declare const every: <A>(collection: Iterable<Predicate<A>>) => Predicate<A>

Source

Since v2.0.0