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

mapOrForUndefinable

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

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

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

§Type Parameters

§Parameters

§
defaultValue: NotUndefined<U>
[src]
§
transformer: TransformFn<T, NotUndefined<U>>
[src]

§Return Type