Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

mapOrElseForNullable

Return the result of transformer with using input as an argument for it if input is not null. Otherwise, return the result of recoverer.

Basically, this operation is a combination map() and unwrapOrElse().

  • U must not be Nullable<*>.
    • If the result of transformer is null, this throw an Error.
    • If the result of recoverer is null, this throw an Error`.
  • If you'd like to accept Nullable<*> as U, use a combination andThen() and orElse().
function mapOrElseForNullable<T, U>(
input: Nullable<T>,
recoverer: RecoveryFn<NotNull<U>>,
transformer: TransformFn<T, NotNull<U>>,
): NotNull<U>;
§
mapOrElseForNullable<T, U>(input: Nullable<T>, recoverer: RecoveryFn<NotNull<U>>, transformer: TransformFn<T, NotNull<U>>): NotNull<U>
[src]

§Type Parameters

§Parameters

§
input: Nullable<T>
[src]
§
recoverer: RecoveryFn<NotNull<U>>
[src]
§
transformer: TransformFn<T, NotNull<U>>
[src]

§Return Type