• Creates a function that memoizes the result of func. If resolver is provided, it determines the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the map cache key. The func is invoked with the this binding of the memoized function.

    Note: The cache is exposed as the cache property on the memoized function.

    Differences from lodash:

    • does not coerce keys to a string; any object can be used as in an ES6 Map
    • does not let you customize cache creation

    Contribution to minified bundle size, when it is the only function imported:

    • Lodash: 4,523 bytes
    • Micro-dash: 231 bytes

    Type Parameters

    • T extends Function

    Parameters

    • func: T
    • resolver: Function = identity

      The function to resolve the cache key.

    Returns T & {
        cache: Map<any, any>;
    }