Vinyl
    Preparing search index...

    Function memoize

    • 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.

      • Optionalcapacity: number

      Returns MemoizedFunction & T

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