effect-io-ai

Package: effect
Module: UndefinedOr

UndefinedOr.match

Pattern matches on an A | undefined value, running onDefined when the value is present or evaluating onUndefined when the value is undefined.

When to use

Use when you need to turn an A | undefined into a non-optional result by handling both the defined and undefined branches in one expression.

See

Signature

declare const match: { <B, A, C = B>(options: { readonly onUndefined: LazyArg<B>; readonly onDefined: (a: A) => C; }): (self: A | undefined) => B | C; <A, B, C = B>(self: A | undefined, options: { readonly onUndefined: LazyArg<B>; readonly onDefined: (a: A) => C; }): B | C; }

Source

Since v4.0.0