fix more cases of no-var

pull/8592/head
Niklas Fiekas 2021-04-07 20:41:14 +02:00
parent 1dba9f3a58
commit 63aa27f78d
5 changed files with 8 additions and 10 deletions

View File

@ -930,8 +930,7 @@ export default function (token: string) {
//Get first move to process, usually the last since movesToProcess is usually 1
SANMove = String(message.param.san[message.param.san.length - i]).trim();
if (verbose) console.info('onmessage - SANMove = ' + SANMove);
var moveObject: NormalMove | undefined; //a move in chessops format
moveObject = <NormalMove>parseSan(localBoard, SANMove); //get move from DGT LiveChess
const moveObject = <NormalMove | undefined>parseSan(localBoard, SANMove); //get move from DGT LiveChess
//if valid move on local chessops
if (moveObject && localBoard.isLegal(moveObject)) {
if (verbose) console.info('onmessage - Move is legal');

View File

@ -94,7 +94,7 @@ function sanOf(board: Board, uci: string) {
// pawn moves
if (pt === 'p') {
var san: string;
let san: string;
if (uci[0] === uci[2]) san = move[1];
else san = uci[0] + 'x' + move[1];
if (move[2]) san += '=' + move[2].toUpperCase();
@ -107,7 +107,7 @@ function sanOf(board: Board, uci: string) {
else return 'O-O';
}
var san = pt.toUpperCase();
let san = pt.toUpperCase();
// disambiguate normal moves
let candidates: number[] = [];

View File

@ -144,7 +144,7 @@ lichess.load.then(() => {
});
};
var tick = function () {
const tick = function () {
const spent = Math.min(duration, new Date().getTime() - startAt);
$bar.css('width', (100 * spent) / duration + '%');
if (spent < duration) setTimeout(tick, tickDelay);

View File

@ -77,8 +77,8 @@ lichess.load.then(() => {
}
function expandYoutubes(as: Candidate[], wait = 100) {
var a = as.shift(),
wait = Math.min(1500, wait);
wait = Math.min(1500, wait);
const a = as.shift();
if (a)
expandYoutube(a)
.find('iframe')

View File

@ -66,10 +66,9 @@ export function build(root: Tree.Node): TreeWrapper {
}
function getCurrentNodesAfterPly(nodeList: Tree.Node[], mainline: Tree.Node[], ply: number): Tree.Node[] {
let node,
nodes = [];
const nodes = [];
for (const i in nodeList) {
node = nodeList[i];
const node = nodeList[i];
if (node.ply <= ply && mainline[i].id !== node.id) break;
if (node.ply > ply) nodes.push(node);
}