if (Object.prototype.hasOwnProperty.call(player, "leave")) {
tablePlayers[playerName].remove();
delete (tablePlayers[playerName]);
+ // eslint-disable-next-line no-continue
continue;
}
factor--;
}
if (Math.round(bag.length * factor) > 0) {
- let shuffleBag = bag.slice();
+ const shuffleBag = bag.slice();
shuffleInPlace(shuffleBag);
newBag = newBag.concat(shuffleBag.slice(0, Math.round(shuffleBag.length * factor)));
}
Game.prototype.playerLeft = function (playerName) {
const playerID = "#" + playerName;
- delete (this.racks[playerID])
- delete (this.scores[playerID])
+ delete (this.racks[playerID]);
+ delete (this.scores[playerID]);
for (const listeningPlayer of this.listeningPlayers) {
writeMessage(listeningPlayer,
JSON.stringify({players: [{player: playerName, leave: "yes"}]}));
}
- if (Object.keys(this.racks).length == 0) {
+ if (Object.keys(this.racks).length === 0) {
for (const gameID of Object.keys(games)) {
if (games[gameID] === this) {
delete (games[gameID]);