ezyVet Javascript Helper Library Documentation
    Preparing search index...

    Function memoize

    • Prevent expensive, repeat function calls by caching the result and returning the cached result when the cacheKey matches

      The cache key must be toString-able. The cache key will automatically default to the first argument of the memoized function, otherwise the cacheKeyGenerator can be used. The cacheKeyGenerator must be used when the first argument is an object, otherwise the cacheKey will be converted to '[object Object]' which could provided unexpected results

      Parameters

      • fn: (...args: any[]) => any

        The function to memoize

      • OptionalcacheKeyGenerator: (...args: any[]) => string

        Optional. Arguments passed in are supplied by the function to be memoized

      Returns (...args: any[]) => any