fix eslint errors
authorLaurent Mazet <mazet@softndesign.org>
Mon, 7 Sep 2020 20:42:14 +0000 (22:42 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Mon, 7 Sep 2020 20:42:14 +0000 (22:42 +0200)
public/trivabble.js

index b2a0291d07b2c9dc49730458dfaa7b1d85efe671..b181f41c9c7f7ae9191883da0b74bac66ad28d56 100644 (file)
                 let letterFactor = 1;
 
                 /* Is a freshly played letter? */
-                if (currentTilePlayed[index] == word.letters[l]) {
+                if (currentTilePlayed[index] === word.letters[l]) {
+
                     /* Letter factor */
                     if (boardCells[index].classList.contains("special-cell-doubleLetter")) {
                         letterFactor = 2;
         }
 
         /* Check for trivabble */
-        let number = 0;
-        for (const i of Object.keys(currentTilePlayed)) {
-            number++;
-        }
-        if (number == 7) {
+        if (Object.keys(currentTilePlayed).length === 7) {
             totalScore += 50;
         }
 
             function () {
                 const scoreCell = tablePlayers[currentPlayer].childNodes[2].childNodes[0];
                 sendCmds([{
-                        cmd: "score",
+                    cmd: "score",
                     player: currentPlayer,
                     score: parseInt(scoreCell.textContent) + totalScore
                 }]);