Fold an Option by supplying a handler for each case. Supports data-first and curried (pipe-friendly) forms.
const label = pipe( fromNullable(order.shippedAt), match({ some: (date) => `Shipped ${date.toDateString()}`, none: () => "Pending", }), ) Copy
const label = pipe( fromNullable(order.shippedAt), match({ some: (date) => `Shipped ${date.toDateString()}`, none: () => "Pending", }), )
Fold an Option by supplying a handler for each case. Supports data-first and curried (pipe-friendly) forms.