The second optional when used optA
is Some
.
optB
or a None
.
import { and, some, none } from "./option.ts";
import { assertEquals } from "../deps.ts";
assertEquals(and(none())(none()), none());
assertEquals(and(none())(some(2)), none());
assertEquals(and(some("foo"))(none()), none());
assertEquals(and(some("foo"))(some(2)), some("foo"));
Generated using TypeDoc
Returns
None
ifoptA
isNone
, otherwise returnsoptB
. The order of arguments is reversed because of that it is useful for partial applying.