Skip to main content

foldW()

const foldW: <B, A, C>(onNone, onSome) => (ma) => B | C = matchW

Alias for matchW.

Pattern matches on an Option with widened return types.


Type Parameters​

B: B​

The return type for None.

A: A​

The value type.

C: C​

The return type for Some.


Parameters​

onNone: () => B​

Handler for None case.

onSome: (a) => C​

Handler for Some case.


Returns​

A function that matches the Option.


Since​

2.0.0