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