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

mapOrAsyncForMaybe

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

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

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

§Type Parameters

§Parameters

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

§Return Type