Skip to main content

flatMapNullable()

flatMapNullable<A, B, E2>(f, onNullable): <E1>(self) => Either<E2 | E1, NonNullable<B>>

FlatMaps over a nullable result.


Type Parameters​

A: A​

The input type.

B: B​

The output type.

E2: E2​

The error type for null/undefined.


Parameters​

f: (a) => Nullish<B>​

The mapping function.

onNullable: (a) => E2​

Function to create error for null/undefined.


Returns: <E1>(self): Either<E2 | E1, NonNullable<B>>​

A function that flatMaps the Either.


Since​

2.0.0