whenIsNullishEmpty
Applies a callback only when the Either is NullishEmpty.
Interactive example
Syntax
Classic signature
typescript
function whenIsNullishEmpty<
const GenericInput extends unknown,
const GenericOutput extends AnyValue | EscapeVoid
>(
input: GenericInput,
theFunction: (value: Unwrap<Extract<ToEither<GenericInput>, EitherNullishEmpty>>) => GenericOutput
): GenericOutput | Exclude<ToEither<GenericInput>, EitherNullishEmpty>;Curried signature
typescript
function whenIsNullishEmpty<
const GenericInput extends unknown,
const GenericOutput extends AnyValue | EscapeVoid
>(
theFunction: (value: Unwrap<Extract<ToEither<GenericInput>, EitherNullishEmpty>>) => GenericOutput
): (input: GenericInput) => GenericOutput | Exclude<ToEither<GenericInput>, EitherNullishEmpty>;Parameters
theFunction: Callback executed in case of absence.input:Eitheror compatible value (optional in the curried version).
Return value
Result of the callback if NullishEmpty, otherwise the original value.
