Package: effect
Module: Option
Checks whether an Option contains a value equivalent to the given one, using a
custom Equivalence.
When to use
Use when you need to test whether an Option contains a value using a
custom equality check.
Details
Some where isEquivalent(value, a) is true → trueSome where not equivalent, or None → falseExample (Checking with custom equivalence)
import { Equivalence, Option } from "effect"
const check = Option.containsWith(Equivalence.strictEqual<number>())
console.log(Option.some(2).pipe(check(2)))
// Output: true
console.log(Option.some(1).pipe(check(2)))
// Output: false
console.log(Option.none().pipe(check(2)))
// Output: false
See
contains for a version using default equalitySignature
declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boolean) => { (a: A): (self: Option<A>) => boolean; (self: Option<A>, a: A): boolean; }
Since v2.0.0