• Returns Some if exactly one of optA and optB is Some, otherwise returns None. The order of arguments is reversed because of that it is useful for partial applying.

    Type Parameters

    • T

    Parameters

    • optB: Option<T>

      The second optional.

    Returns ((optA) => Option<T>)

    optA exclusive or optB.

    Examples

    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