Package: effect
Module: Predicate
Transforms the input of a predicate using a mapping function.
When to use
Use when you have a predicate on A and want to check B values by mapping
each B to an A, such as checking lengths or projections.
Details
Returns a new predicate that applies f before self. There is no
additional short-circuiting beyond what self does.
Example (Checking string length)
import { Predicate } from "effect"
const isLongerThan2 = Predicate.mapInput((s: string) => s.length)(
(n: number) => n > 2
)
console.log(isLongerThan2("hello"))
See
PredicateandnotSignature
declare const mapInput: { <B, A>(f: (b: B) => A): (self: Predicate<A>) => Predicate<B>; <A, B>(self: Predicate<A>, f: (b: B) => A): Predicate<B>; }
Since v2.0.0