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

mapOrForOption

Return the result of transformer with using input as an argument for it if input is Some(T). Otherwise, return defaultValue.

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

function mapOrForOption<T, U>(
input: Option<T>,
defaultValue: U,
transformer: TransformFn<T, U>,
): U;
§
mapOrForOption<T, U>(input: Option<T>, defaultValue: U, transformer: TransformFn<T, U>): U
[src]

§Type Parameters

§Parameters

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

§Return Type