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

    Function flatMap

    • Maps an inner value of Cat into another Cat by applying a function. It is useful to lift a subroutine with Cat.

      Type Parameters

      • T
      • U

      Parameters

      • fn: (t: T) => Cat.Cat<U>

        A function which maps from T to Cat<U>.

      Returns (c: Cat.Cat<T>) => Cat.Cat<U>

      A lifted function which maps from Cat<T> to Cat<U>.

      Examples

      const sub = (num: number): Cat<string> =>
      cat(num).feed((x) => x.toString());
      const actual = flatMap(sub)(cat(6)).value;
      expect(actual).toStrictEqual("6");