Skip to main content

matchW()

matchW<E, B, A, C>(onLeft, onRight): (ma) => B | C

Pattern matches on an Either with widened return types.


Type Parametersโ€‹

E: Eโ€‹

The error type.

B: Bโ€‹

The return type for Left.

A: Aโ€‹

The success type.

C: Cโ€‹

The return type for Right.


Parametersโ€‹

onLeft: (e) => Bโ€‹

Handler for Left case.

onRight: (a) => Cโ€‹

Handler for Right case.


Returnsโ€‹

A function that takes an Either and returns B or C.


Sinceโ€‹

2.0.0