Skip to content

Commit afc69be

Browse files
committed
fix: replace loose equality with strict equality (!=, == → !==, ===)
1 parent 457fef4 commit afc69be

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

js/blocks/BoxesBlocks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ function setupBoxesBlocks(activity) {
469469
const parentId = connections?.[0];
470470
if (
471471
logo.inStatusMatrix &&
472-
parentId != null &&
472+
parentId !== null &&
473473
parentId in activity.blocks.blockList &&
474474
activity.blocks.blockList[parentId]?.name === "print"
475475
) {

js/blocks/FlowBlocks.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ function setupFlowBlocks(activity) {
244244
for (let i = 0; i < n; i++) {
245245
const obj = logo.connectionStore[turtle][blk].pop();
246246
activity.blocks.blockList[obj[0]].connections[obj[1]] = obj[2];
247-
if (obj[2] != null) {
247+
if (obj[2] !== null) {
248248
activity.blocks.blockList[obj[2]].connections[0] = obj[0];
249249
}
250250
}
@@ -273,7 +273,7 @@ function setupFlowBlocks(activity) {
273273
try {
274274
// Check to see if another turtle has already disconnected these blocks
275275
const otherTurtle = __lookForOtherTurtles(blk, turtle);
276-
if (otherTurtle != null) {
276+
if (otherTurtle !== null) {
277277
// Copy the connections and queue the blocks
278278
logo.connectionStore[turtle][blk] = [];
279279
for (let i = logo.connectionStore[otherTurtle][blk].length; i > 0; i--) {
@@ -294,7 +294,7 @@ function setupFlowBlocks(activity) {
294294
}
295295
} else {
296296
let child = activity.blocks.findBottomBlock(args[1]);
297-
while (child != blk) {
297+
while (child !== blk) {
298298
if (activity.blocks.blockList[child].name !== "hidden") {
299299
const queueBlock = new Queue(child, factor, blk, receivedArg);
300300
tur.parentFlowQueue.push(blk);
@@ -309,14 +309,14 @@ function setupFlowBlocks(activity) {
309309
// run
310310
logo.connectionStore[turtle][blk] = [];
311311
child = args[1];
312-
while (child != null) {
312+
while (child !== null) {
313313
const lastConnection =
314314
activity.blocks.blockList[child].connections.length - 1;
315315
const nextBlk =
316316
activity.blocks.blockList[child].connections[lastConnection];
317317
// Don't disconnect a hidden block from its parent
318318
if (
319-
nextBlk != null &&
319+
nextBlk !== null &&
320320
activity.blocks.blockList[nextBlk].name === "hidden"
321321
) {
322322
logo.connectionStore[turtle][blk].push([
@@ -336,7 +336,7 @@ function setupFlowBlocks(activity) {
336336
child = nextBlk;
337337
}
338338

339-
if (child != null) {
339+
if (child !== null) {
340340
activity.blocks.blockList[child].connections[0] = null;
341341
}
342342
}
@@ -534,7 +534,7 @@ function setupFlowBlocks(activity) {
534534
// Run the cases here.
535535
let switchCase;
536536
const argBlk = activity.blocks.blockList[switchBlk].connections[1];
537-
if (argBlk == null) {
537+
if (argBlk === null) {
538538
switchCase = "__default__";
539539
} else {
540540
switchCase = logo.parseArg(logo, turtle, argBlk, logo.receivedArg);
@@ -659,7 +659,7 @@ function setupFlowBlocks(activity) {
659659

660660
// Since we pop the queue, we need to unhighlight our parent
661661
const parentBlk = activity.blocks.blockList[blk].connections[0];
662-
if (parentBlk != null) {
662+
if (parentBlk !== null) {
663663
if (!tur.singer.suppressOutput && tur.singer.justCounting.length === 0) {
664664
tur.unhighlightQueue.push(parentBlk);
665665
}

js/turtle-singer.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,13 @@ class Singer {
493493

494494
// We need to save the state of the boxes and heap although there is a potential of a boxes collision with other turtles
495495
// eslint-disable-next-line eqeqeq
496-
const saveBoxes = logo.boxes != null ? deepClone(logo.boxes) : undefined;
496+
const saveBoxes = logo.boxes !== null ? deepClone(logo.boxes) : undefined;
497497
// eslint-disable-next-line eqeqeq
498498
const saveTurtleHeaps =
499-
logo.turtleHeaps[turtle] != null ? deepClone(logo.turtleHeaps[turtle]) : undefined;
499+
logo.turtleHeaps[turtle] !== null ? deepClone(logo.turtleHeaps[turtle]) : undefined;
500500
// eslint-disable-next-line eqeqeq
501501
const saveTurtleDicts =
502-
logo.turtleDicts[turtle] != null ? deepClone(logo.turtleDicts[turtle]) : undefined;
502+
logo.turtleDicts[turtle] !== null ? deepClone(logo.turtleDicts[turtle]) : undefined;
503503
// .. and the turtle state
504504
const saveX = tur.x;
505505
const saveY = tur.y;
@@ -613,13 +613,13 @@ class Singer {
613613
const saveState = {
614614
suppressOutput: tur.singer.suppressOutput,
615615
// eslint-disable-next-line eqeqeq
616-
boxes: logo.boxes != null ? deepClone(logo.boxes) : undefined,
616+
boxes: logo.boxes !== null ? deepClone(logo.boxes) : undefined,
617617
// eslint-disable-next-line eqeqeq
618618
turtleHeaps:
619-
logo.turtleHeaps[turtle] != null ? deepClone(logo.turtleHeaps[turtle]) : undefined,
619+
logo.turtleHeaps[turtle] !== null ? deepClone(logo.turtleHeaps[turtle]) : undefined,
620620
// eslint-disable-next-line eqeqeq
621621
turtleDicts:
622-
logo.turtleDicts[turtle] != null ? deepClone(logo.turtleDicts[turtle]) : undefined,
622+
logo.turtleDicts[turtle] !== null ? deepClone(logo.turtleDicts[turtle]) : undefined,
623623
x: tur.x,
624624
y: tur.y,
625625
color: tur.painter.color,
@@ -677,13 +677,13 @@ class Singer {
677677
});
678678

679679
// eslint-disable-next-line eqeqeq
680-
activity.logo.boxes = saveState.boxes != null ? saveState.boxes : {};
680+
activity.logo.boxes = saveState.boxes !== null ? saveState.boxes : {};
681681
// eslint-disable-next-line eqeqeq
682682
activity.logo.turtleHeaps[turtle] =
683-
saveState.turtleHeaps != null ? saveState.turtleHeaps : {};
683+
saveState.turtleHeaps !== null ? saveState.turtleHeaps : {};
684684
// eslint-disable-next-line eqeqeq
685685
activity.logo.turtleDicts[turtle] =
686-
saveState.turtleDicts != null ? saveState.turtleDicts : {};
686+
saveState.turtleDicts !== null ? saveState.turtleDicts : {};
687687

688688
tur.painter.doPenUp();
689689
tur.painter.doSetXY(saveState.x, saveState.y);

0 commit comments

Comments
 (0)