The default value.
The mapped value or init
.
import { some, mapOr, none } from "./option.ts";
import { assertEquals } from "../deps.ts";
const strLenOrAnswer = mapOr(42)((str: string) => str.length);
assertEquals(strLenOrAnswer(some("Hello, World!")), 13);
assertEquals(strLenOrAnswer(none()), 42);
Generated using TypeDoc
Maps the optional value with a default value
init
.