Skip to main content

fromPredicate()

fromPredicate<A, E>(predicate, onFalse): (a) => Either<E, A>

Creates an Either from a predicate.


Type Parametersโ€‹

A: Aโ€‹

The value type.

E: Eโ€‹

The error type.


Parametersโ€‹

predicate: (a) => booleanโ€‹

The predicate function.

onFalse: (a) => Eโ€‹

Function to create error when predicate fails.


Returnsโ€‹

A function that creates an Either from a value.


Sinceโ€‹

2.0.0