Skip to content

Commit

Permalink
use === instead of ==
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecat committed Sep 5, 2023
1 parent 7651bbe commit 2138c5e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ function commandDRAW(args) {
const wx = sx >= dx ? sx - dx : dx - sx, wy = sy >= dy ? sy - dy : dy - sy;
const xmode = wx >= wy;
let x = sx, y = sy, gosa = 0;
while (x != dx || y != dy) {
while (x !== dx || y !== dy) {
drawPoint(x, y);
if (xmode) {
if (sx < dx) x++; else x--;
Expand Down
28 changes: 14 additions & 14 deletions docs/Compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,20 +419,20 @@ const basicFunctions = {
};

const expr7_ops = {
"OR" : function(a, b) { return a != 0 || b != 0 ? 1 : 0; },
"||" : function(a, b) { return a != 0 || b != 0 ? 1 : 0; }
"OR" : function(a, b) { return a !== 0 || b !== 0 ? 1 : 0; },
"||" : function(a, b) { return a !== 0 || b !== 0 ? 1 : 0; }
};

const expr6_ops = {
"AND": function(a, b) { return a != 0 && b != 0 ? 1 : 0; },
"&&" : function(a, b) { return a != 0 && b != 0 ? 1 : 0; }
"AND": function(a, b) { return a !== 0 && b !== 0 ? 1 : 0; },
"&&" : function(a, b) { return a !== 0 && b !== 0 ? 1 : 0; }
};

const expr5_ops = {
"=" : function(a, b) { return a == b ? 1 : 0; },
"==" : function(a, b) { return a == b ? 1 : 0; },
"<>" : function(a, b) { return a != b ? 1 : 0; },
"!=" : function(a, b) { return a != b ? 1 : 0; },
"=" : function(a, b) { return a === b ? 1 : 0; },
"==" : function(a, b) { return a === b ? 1 : 0; },
"<>" : function(a, b) { return a !== b ? 1 : 0; },
"!=" : function(a, b) { return a !== b ? 1 : 0; },
"<" : function(a, b) { return a < b ? 1 : 0; },
">" : function(a, b) { return a > b ? 1 : 0; },
"<=" : function(a, b) { return a <= b ? 1 : 0; },
Expand All @@ -448,15 +448,15 @@ const expr4_ops = {
const expr3_ops = {
"*" : function(a, b) { return arithWrap(a * b); },
"/" : function(a, b) {
if (b == 0) throw "Divide by 0";
if (b === 0) throw "Divide by 0";
return arithWrap(a / b);
},
"%" : function(a, b) {
if (b == 0) throw "Divide by 0";
if (b === 0) throw "Divide by 0";
return arithWrap(a % b);
},
"MOD": function(a, b) {
if (b == 0) throw "Divide by 0";
if (b === 0) throw "Divide by 0";
return arithWrap(a % b);
},
"<<" : function(a, b) { return (b & 0xff) >= 16 ? 0 : arithWrap(a << (b & 15)); },
Expand All @@ -468,8 +468,8 @@ const expr3_ops = {
const expr2_ops = {
"-" : function(a) { return arithWrap(-a); },
"~" : function(a) { return arithWrap(~a); },
"!" : function(a) { return a == 0 ? 1 : 0; },
"NOT": function(a) { return a == 0 ? 1 : 0; }
"!" : function(a) { return a === 0 ? 1 : 0; },
"NOT": function(a) { return a === 0 ? 1 : 0; }
};

const basicConstants = {
Expand Down Expand Up @@ -977,7 +977,7 @@ var compiler = (function() {
if (nstr.charAt(0) === "#") {
nstr = nstr.substr(1);
delta = 16;
} else if (nstr.charAt(0) == "`") {
} else if (nstr.charAt(0) === "`") {
nstr = nstr.substr(1);
delta = 2;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/Functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ function functionLEN(args) {
let ptr = args[0];
for (;;) {
const c = readVirtualMem(ptr + count);
if (c == 0 || c == 0x22) return count;
if (c === 0 || c === 0x22) return count;
count++;
}
}
Expand Down
10 changes: 5 additions & 5 deletions docs/OneFiveCrowd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ function keyDown(key, shiftKey, ctrlKey, altKey) {
else if (0x77 <= keyCode && keyCode <= 0x7a) keyCode += 0x80 - 0x77;
else if (keyCode === 0x7e) keyCode = 0x40;
}
if (shiftKey && keyCode == 0x20) keyCode = 0x0e;
if (shiftKey && keyCode === 0x20) keyCode = 0x0e;
keyRomanInput(keyCode);
} else if (!altKey) {
if (key === "Enter") {
Expand Down Expand Up @@ -1446,7 +1446,7 @@ function keyUp(key) {
else if (key === "ArrowUp") btnStatus &= ~4;
else if (key === "ArrowDown") btnStatus &= ~8;
else if (key === " ") btnStatus &= ~0x10;
else if (key === "x" || key == "X") btnStatus &= ~0x20;
else if (key === "x" || key === "X") btnStatus &= ~0x20;
ramBytes[BTN_ADDR] = btnStatus;
}

Expand Down Expand Up @@ -1514,7 +1514,7 @@ function putChar(c, isInsert = false) {
if (cursorX < 0 || SCREEN_WIDTH <= cursorX || cursorY < 0 || SCREEN_HEIGHT <= cursorY) return;
switch (c) {
case 0x08: // Backspace
if (cursorX > 0 || (cursorY > 0 && vramView[cursorY * SCREEN_WIDTH - 1] != 0)) {
if (cursorX > 0 || (cursorY > 0 && vramView[cursorY * SCREEN_WIDTH - 1] !== 0)) {
const limit = SCREEN_HEIGHT * SCREEN_WIDTH - 1;
const start = cursorY * SCREEN_WIDTH + cursorX - 1;
let stop;
Expand Down Expand Up @@ -1732,7 +1732,7 @@ function putChar(c, isInsert = false) {
for (; start > 0 && vramView[start - 1] !== 0; start--);
}
for (; stop < limit && vramView[stop] !== 0; stop++);
if (start == stop) break;
if (start === stop) break;
for (let i = start; i < stop; i++) {
vramView[i] = 0;
}
Expand Down Expand Up @@ -1917,7 +1917,7 @@ function editProgram(lineno, str) {
}
// 必要に応じてデータを移動する
let newLastPos = lastPos;
if (replaceSize != addSize) {
if (replaceSize !== addSize) {
const moveSrc = replacePos + replaceSize;
const moveDest = replacePos + addSize;
const moveSize = lastPos - moveSrc;
Expand Down
2 changes: 1 addition & 1 deletion docs/VirtualMixJuice.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ const virtualMixJuice = (function() {
function rx(data, dataBps) {
if (!uartConnected || dataBps !== deviceBps) return;
for (let i = 0; i < data.length; i++) {
if (data[i] == 0x0A) {
if (data[i] === 0x0A) {
enqueueLine(lineBuffer);
lineBuffer = "";
} else {
Expand Down

0 comments on commit 2138c5e

Please sign in to comment.