• Returns a wrapper function where when called, retains the return value of inner, returning that value on consecutive calls without invoking inner again.

    Type Parameters

    • T extends (() => any)

    Parameters

    • inner: T

      The function to memoize results.

    Returns MemoizedFunction & T

    Returns a memoized function with a clear method to reset the cached value.

  • Returns a wrapper function where when called, retains the return value of inner, returning that value on consecutive calls without invoking inner again.

    Type Parameters

    Parameters

    • inner: T

      The function to memoize results.

    • keyProvider: ((...args: Parameters<T>) => any)

      When more than one parameter is expected, a keyProvider is required, which returns a unique key given the arguments provided to the memoized function.

        • (...args): any
        • Parameters

          • Rest...args: Parameters<T>

          Returns any

    • Optionalcapacity: number

    Returns MemoizedFunction & T

    Returns a memoized function with a clear method to reset the cache.