The second optional.
optA
exclusive or optB
.
import { some, none, xor } from "./option.ts";
import { assertEquals } from "../deps.ts";
assertEquals(xor(none())(none()), none());
assertEquals(xor(none())(some(2)), some(2));
assertEquals(xor(some(100))(none()), some(100));
assertEquals(xor(some(100))(some(2)), none());
Generated using TypeDoc
Returns
Some
if exactly one ofoptA
andoptB
isSome
, otherwise returnsNone
. The order of arguments is reversed because of that it is useful for partial applying.