Getting the character index of recurring substring
I don't believe hashing the key provides any functionality: storing the searched string directly into the map would work.

Your map variable is effectively working as a list of hashed keys, not as an actual key-value mapping. Instead of pushing the keys to the collection, override the existing key if it exists, and set the value to be the last found index.

Utilizing the map this way, your code simplifies immensely, and it no longer relies on third-party libraries:

function multiIndexOf (s) {
  var map = [];
  return function (key) {
    var nextIndex = map[key] + 1;
    map[key] = s.indexOf(key, nextIndex);
    return map[key];
  }
}

var find = multiIndexOf('hello world, hello darling')

// Example usage
console.log(find('hello')) // =&gt; 0
console.log(find('hello')) // =&gt; 13
console.log(find('hello')) // =&gt; -1
console.log(find('hello')) // =&gt; 0
console.log(find('hello')) // =&gt; 13
console.log(find('el')) // =&gt; 1
console.log(find('ell')) // =&gt; 1
console.log(find('ell')) // =&gt; 14