The error used when opt
is a None
.
The new Result
.
import { okOr, some, none } from "./option.ts";
import { err, ok } from "./result.ts";
import { assertEquals } from "../deps.ts";
const orZero = okOr(0);
assertEquals(orZero(some("foo")), ok("foo"));
assertEquals(orZero(none()), err(0));
Generated using TypeDoc
Transforms the optional value into
Result
with the errore
.