• Zips two optionals into one.

    Type Parameters

    • T

    Parameters

    • optA: Option<T>

      The left-side optional.

    Returns (<U>(optB) => Option<[T, U]>)

    The zipped optional of tuple.

    Examples

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

    assertEquals(zip(some(1))(some("hi")), some([1, "hi"] as [number, string]));
    assertEquals(zip(some(1))(none()), none());
    assertEquals(zip(none())(some(1)), none());
    assertEquals(zip(none())(none()), none());

Generated using TypeDoc