• Returns the optional optA if it contains a value, otherwise returns optB. The order of arguments is reversed because of that it is useful for partial applying.

    Type Parameters

    • T

    Parameters

    • optB: Option<T>

      The fallback optional.

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

    optA or optB.

    Examples

    import { or, some, none } from "./option.ts";
    import { assertEquals } from "../deps.ts";

    assertEquals(or(none())(none()), none());
    assertEquals(or(none())(some(2)), some(2));
    assertEquals(or(some(100))(none()), some(100));
    assertEquals(or(some(100))(some(2)), some(2));

Generated using TypeDoc