The function to provide a default value.
The contained value or fn()
.
import { some, none, unwrapOrElse } from "./option.ts";
import { assertEquals } from "../deps.ts";
const unwrapOrCalc = unwrapOrElse(() => 6 ** 4);
assertEquals(unwrapOrCalc(some(4)), 4);
assertEquals(unwrapOrCalc(none()), 1296);
Generated using TypeDoc
Extracts the contained
Some
value orfn()
.