• Returns a new function, that returns and caches the results of the given function, solely based on the single argument.

    Think of it as a slimmed down version of memoize, by only supporting functions with a single argument and comparing by reference. This increases performance but reduces possible applications.

    See

    eagerLookup

    Type Parameters

    Type Parameters

    • K

    • V

    Parameters

    • producer: ((key: K) => V)

      a function to produce the value for the given key

        • (key: K): V
        • Parameters

          • key: K

          Returns V

    • cache: PickMap<K, V, "get" | "has" | "set"> = ...

      a map to act as the cache

    Returns ((key: K) => V)

      • (key: K): V
      • Parameters

        • key: K

        Returns V

Generated using TypeDoc