Skip to content

match

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

Defined in: Core/Option.ts:182

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

A

B

() => B

(a) => B

(data): B

Option<A>

B

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