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

mapOrElseForUndefinable

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

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

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

§Type Parameters

§Parameters

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

§Return Type