code: function collateStrings(a, b) {
      var aValue, bValue, aChar, bChar, aEquiv, bEquiv, index = 0, tiebreaker = 0;
      a = getCollationReadyString(a);
      b = getCollationReadyString(b);
      do {
        aChar  = getCollationCharacter(a, index);
        bChar  = getCollationCharacter(b, index);
        aValue = getCollationValue(aChar);
        bValue = getCollationValue(bChar);
        if(aValue === -1 || bValue === -1) {
          aValue = a.charCodeAt(index) || null;
          bValue = b.charCodeAt(index) || null;
        }
        aEquiv = aChar !== a.charAt(index);
        bEquiv = bChar !== b.charAt(index);
        if(aEquiv !== bEquiv && tiebreaker === 0) {
          tiebreaker = aEquiv - bEquiv;
        }
        index += 1;
      } while(aValue != null && bValue != null && aValue === bValue);
      if(aValue === bValue) return tiebreaker;
      return aValue < bValue ? -1 : 1;
    }
docs: Alphanumeric collation helpers