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

    Type Parameters

    • U

    Parameters

    • optB: Option<U>

      The second optional when used optA is Some.

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

    optB or a None.

    Examples

    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