Skip to content

match

match<A, B>(cases): (data) => B

Defined in: Core/Maybe.ts:169

Pattern matches on a Maybe, returning the result of the matching case.

A

B

() => B

(a) => B

(data): B

Maybe<A>

B

pipe(
  optionUser,
  Maybe.match({
    some: user => `Hello, ${user.name}`,
    none: () => "Hello, stranger"
  })
);