whenIsNullishEmpty
Applique un callback uniquement quand l'Either est NullishEmpty.
Exemple interactif
Syntaxe
Signature classique
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>;Signature currifiée
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>;Paramètres
theFunction: Callback exécuté en cas d'absence.input:Eitherou valeur compatible (optionnel en version currifiée).
Valeur de retour
Résultat du callback si NullishEmpty, sinon la valeur originale.
