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

mapOrAsyncForNullable

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

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

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

§Type Parameters

§Parameters

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

§Return Type

§
Promise<NotNull<U>>
[src]