function memoize(compute) {
  let cachedArgs = [];
  let cachedResult;

  return function memoizedFunc() {
    if (!isEqual(arguments, cachedArgs)) {
      cachedResult = compute.apply(this, arguments);
      cachedArgs = Array.from(arguments);
    }
    return cachedResult;
  };
}
Speed up consecutive function calls by caching the result of calls with identical input
https://en.wikipedia.org/wiki/Memoization
@param {function} compute - the function to be memoized