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

mapOrForMaybe

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 mapOrForMaybe<T, U>(
input: Maybe<T>,
defaultValue: NotNullOrUndefined<U>,
transformer: TransformFn<T, NotNullOrUndefined<U>>,
): NotNullOrUndefined<U>;
§
mapOrForMaybe<T, U>(input: Maybe<T>, defaultValue: NotNullOrUndefined<U>, transformer: TransformFn<T, NotNullOrUndefined<U>>): NotNullOrUndefined<U>
[src]

§Type Parameters

§Parameters

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