<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 | CPattern 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.
Source effect/UndefinedOr.ts:5116 lines
export const 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
}
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.
match: {
<function (type parameter) B in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
B, function (type parameter) A in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
A, function (type parameter) C in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
C = function (type parameter) B in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
B>(options: {
readonly onUndefined: LazyArg<B>
readonly onDefined: (a: A) => C
}
options: {
readonly onUndefined: LazyArg<B>onUndefined: import LazyArgLazyArg<function (type parameter) B in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
B>
readonly onDefined: (a: A) => ConDefined: (a: Aa: function (type parameter) A in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
A) => function (type parameter) C in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
C
}): (self: A | undefinedself: function (type parameter) A in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
A | undefined) => function (type parameter) B in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
B | function (type parameter) C in <B, A, C = B>(options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): (self: A | undefined) => B | C
C
<function (type parameter) A in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
A, function (type parameter) B in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
B, function (type parameter) C in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
C = function (type parameter) B in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
B>(self: A | undefinedself: function (type parameter) A in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
A | undefined, options: {
readonly onUndefined: LazyArg<B>
readonly onDefined: (a: A) => C
}
options: {
readonly onUndefined: LazyArg<B>onUndefined: import LazyArgLazyArg<function (type parameter) B in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
B>
readonly onDefined: (a: A) => ConDefined: (a: Aa: function (type parameter) A in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
A) => function (type parameter) C in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
C
}): function (type parameter) B in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
B | function (type parameter) C in <A, B, C = B>(self: A | undefined, options: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
C
} = import dualdual(
2,
<function (type parameter) A in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
A, function (type parameter) B in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
B, function (type parameter) C in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
C = function (type parameter) B in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
B>(self: A | undefinedself: function (type parameter) A in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
A | undefined, { onDefined: (a: A) => ConDefined, onUndefined: LazyArg<B>onUndefined }: {
readonly onUndefined: LazyArg<B>onUndefined: import LazyArgLazyArg<function (type parameter) B in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
B>
readonly onDefined: (a: A) => ConDefined: (a: Aa: function (type parameter) A in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
A) => function (type parameter) C in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
C
}): function (type parameter) B in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
B | function (type parameter) C in <A, B, C = B>(self: A | undefined, { onDefined, onUndefined }: {
readonly onUndefined: LazyArg<B>;
readonly onDefined: (a: A) => C;
}): B | C
C => self: A | undefinedself === var undefinedundefined ? onUndefined: LazyArg<B>onUndefined() : onDefined: (a: A) => ConDefined(self: A & ({} | null)self)
)