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

mapOrElseAsyncForNullable

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 mapAsync() and unwrapOrElseAsync().

  • 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 andThenAsync() and orElseAsync().
function mapOrElseAsyncForNullable<T, U>(
input: Nullable<T>,
recoverer: AsyncRecoveryFn<NotNull<U>>,
transformer: AsyncTransformFn<T, NotNull<U>>,
): Promise<NotNull<U>>;
§
mapOrElseAsyncForNullable<T, U>(input: Nullable<T>, recoverer: AsyncRecoveryFn<NotNull<U>>, transformer: AsyncTransformFn<T, NotNull<U>>): Promise<NotNull<U>>
[src]

§Type Parameters

§Parameters

§
input: Nullable<T>
[src]
§
recoverer: AsyncRecoveryFn<NotNull<U>>
[src]
§
transformer: AsyncTransformFn<T, NotNull<U>>
[src]

§Return Type

§
Promise<NotNull<U>>
[src]