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

mapOrElseAsyncForMaybe

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

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

  • U must not be Maybe<*>.
    • If the result of transformer is null or undefined, this throw an Error.
    • If the result of recoverer is null or undefined, this throw an Error.
  • If you'd like to accept Maybe<*> as U, use a combination andThen() and orElse().
function mapOrElseAsyncForMaybe<T, U>(
input: Maybe<T>,
recoverer: AsyncRecoveryFn<NotNullOrUndefined<U>>,
transformer: AsyncTransformFn<T, NotNullOrUndefined<U>>,
): Promise<NotNullOrUndefined<U>>;
§
mapOrElseAsyncForMaybe<T, U>(input: Maybe<T>, recoverer: AsyncRecoveryFn<NotNullOrUndefined<U>>, transformer: AsyncTransformFn<T, NotNullOrUndefined<U>>): Promise<NotNullOrUndefined<U>>
[src]

§Type Parameters

§Parameters

§
input: Maybe<T>
[src]
§
recoverer: AsyncRecoveryFn<NotNullOrUndefined<U>>
[src]
§
transformer: AsyncTransformFn<T, NotNullOrUndefined<U>>
[src]

§Return Type