Aller au contenu principal

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