code: function memoizeFunction(fn) {
    var memo = {}, counter = 0;
  
    return function(key) {
      if (hasOwn(memo, key)) {
        return memo[key];
      }
      // istanbul ignore if
      if (counter === INTERNAL_MEMOIZE_LIMIT) {
        memo = {};
        counter = 0;
      }
      counter++;
      return memo[key] = fn(key);
    };
  }
docs: Note that attemps to consolidate this with Function#memoize ended up clunky as that is also serializing arguments. Separating these implementations turned out to be simpler.