• Extracts the contained Some value or init.

    Type Parameters

    • T

    Parameters

    • init: T

      The default value.

    Returns ((opt) => T)

    The contained value or init.

    Examples

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

    const unwrapOrBike = unwrapOr("bike");

    assertEquals(unwrapOrBike(some("car")), "car");
    assertEquals(unwrapOrBike(none()), "bike");
      • (opt): T
      • Parameters

        Returns T

Generated using TypeDoc