Package: effect
Module: Predicate
Creates a predicate that returns true if either predicate is true.
When to use
Use when you want to combine Predicates with OR, accepting values that
satisfy at least one condition, including refinements that narrow to a union.
Details
Evaluation short-circuits on the first true. For refinements, the output
type is a union.
Example (Checking either condition)
import { Predicate } from "effect"
const isStringOrNumber = Predicate.or(Predicate.isString, Predicate.isNumber)
console.log(isStringOrNumber("a"))
See
andxorSignature
declare const or: { <A, C extends A>(that: Refinement<A, C>): <B extends A>(self: Refinement<A, B>) => Refinement<A, B | C>; <A, B extends A, C extends A>(self: Refinement<A, B>, that: Refinement<A, C>): Refinement<A, B | C>; <A>(that: Predicate<A>): (self: Predicate<A>) => Predicate<A>; <A>(self: Predicate<A>, that: Predicate<A>): Predicate<A>; }
Since v2.0.0