Got exception on the "return a.name.localeCompare(b.name);" line
Code Select
key: "createUniqueInitials",
value: function createUniqueInitials() {
var players = this.game.state.players;
players.sort(function (a, b) {
return a.name.localeCompare(b.name);
});
var previousPrefix = 1;
for (var i = 0; i < players.length - 1; i++) {
var prefix = 1;
for (; prefix < players[i].name.length; prefix++) {
if (players[i].name[prefix - 1].toLowerCase() !== players[i + 1].name[prefix - 1].toLowerCase()) break;
}
players[i].initials = players[i].name.slice(0, Math.max(previousPrefix, prefix));
previousPrefix = prefix;
}
if (players.length > 1 && players[players.length - 2].name.length === previousPrefix) previousPrefix += 1;
players[players.length - 1].initials = players[players.length - 1].name.slice(0, previousPrefix);
players.sort(function (a, b) {
return a.index - b.index;
});
}