Skip to main content

filterOrElse()

filterOrElse<A, E>(predicate, onFalse): (self) => Either<E, A>

Filters the Right value with a predicate, returning Left if it fails.


Type Parametersโ€‹

A: Aโ€‹

The success type.

E: Eโ€‹

The error type.


Parametersโ€‹

predicate: (a) => booleanโ€‹

The predicate to test.

onFalse: (a) => Eโ€‹

Function to create error when predicate fails.


Returnsโ€‹

A function that filters the Either.


Sinceโ€‹

2.0.0