hash(s) {
    if (typeof s !== 'string') s = JSON.stringify(s);
    let hash = 0;
    for (let i = 0; i < s.length; i++) {
      hash = (hash << 5) - hash + s.charCodeAt(i);
      hash &= hash; // Keep it a 32bit int
    }
    return hash;
  }
(Same algorithm as Java's String.hashCode)
Returns a hash code for this string. The hash code for a String object is
computed as: s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
using int arithmetic, where s[i] is the ith character of the string,
n is the length of the string, and ^ indicates exponentiation.
(The hash value of the empty string is zero.)