Function memoize

  • This is a generic memoization function

    This implementation uses a cache independent of the function being memoized to allow old values to be garbage collected when the memoized function goes out of scope.

    Parameters

    • fn: Callback<unknown, unknown>

      The function object to memoize

    • hashFunction: HashFunction = DEFAULT_HASH_FUNCTION

    Returns Callback<Any>