• Maps the function onto Option.

    Type Parameters

    • T

    • U

    Parameters

    • f: ((t) => U)

      The function from T to U.

        • (t): U
        • Parameters

          • t: T

          Returns U

    Returns ((opt) => Option<U>)

    The function from Option<T> to Option<U>.

    Examples

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

    const strLen = map((str: string) => str.length);

    assertEquals(strLen(some("Hello, World!")), some(13));
    assertEquals(strLen(none()), none());

Generated using TypeDoc