@mikuroxina/mini-fn
    Preparing search index...

    Function map

    • Maps the function onto Option.

      Type Parameters

      • T
      • U

      Parameters

      • f: (t: T) => U

        The function from T to U.

      Returns (opt: Option.Option<T>) => Option.Option<U>

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

      Examples

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

      expect(strLen(some("Hello, World!"))).toStrictEqual(some(13));
      expect(strLen(none())).toStrictEqual(none());