Skip to content

Commit 2f21b66

Browse files
committed
Use strict equality checks throughout codebase
Replaced all instances of '==' and '!=' with '===' and '!==' in canvas renderer, curves utility, and test files for consistency and to prevent type coercion issues.
1 parent cc1e8f4 commit 2f21b66

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/renderers/canvas.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { Commands } from '../utils/path-commands.js';
2-
import { decomposeMatrix, mod, TWO_PI, getEffectiveStrokeWidth } from '../utils/math.js';
2+
import {
3+
decomposeMatrix,
4+
mod,
5+
TWO_PI,
6+
getEffectiveStrokeWidth,
7+
} from '../utils/math.js';
38
import { Curve } from '../utils/curves.js';
49
import { Events } from '../events.js';
510
import { getRatio } from '../utils/device-pixel-ratio.js';
@@ -1253,6 +1258,11 @@ function svgAngle(ux, uy, vx, vy) {
12531258
// Returns true if this is a non-transforming matrix
12541259
function isDefaultMatrix(m) {
12551260
return (
1256-
m[0] == 1 && m[3] == 0 && m[1] == 0 && m[4] == 1 && m[2] == 0 && m[5] == 0
1261+
m[0] === 1 &&
1262+
m[3] === 0 &&
1263+
m[1] === 0 &&
1264+
m[4] === 1 &&
1265+
m[2] === 0 &&
1266+
m[5] === 0
12571267
);
12581268
}

src/utils/curves.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function getCurveBoundingBox(x1, y1, x2, y2, x3, y3, x4, y4) {
245245
let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
246246

247247
for (let i = 0; i < 2; ++i) {
248-
if (i == 0) {
248+
if (i === 0) {
249249
b = 6 * x1 - 12 * x2 + 6 * x3;
250250
a = -3 * x1 + 9 * x2 - 9 * x3 + 3 * x4;
251251
c = 3 * x2 - 3 * x1;

tests/src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
xhr.open('GET', path, true);
9090

9191
xhr.onreadystatechange = function (e) {
92-
if (xhr.readyState != 4 || xhr.status != 200) {
92+
if (xhr.readyState !== 4 || xhr.status !== 200) {
9393
return;
9494
}
9595

@@ -113,7 +113,7 @@
113113
}
114114

115115
xhr.onreadystatechange = function (e) {
116-
if (xhr.readyState != 4 || xhr.status != 200) {
116+
if (xhr.readyState !== 4 || xhr.status !== 200) {
117117
return;
118118
}
119119

tests/suite/shapes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ QUnit.test('Two.Rectangle', function (assert) {
587587

588588
for (var i = 0; i < Two.Rectangle.Properties.length; i++) {
589589
var prop = Two.Rectangle.Properties[i];
590-
var isOrigin = i == 2;
590+
var isOrigin = i === 2;
591591
assert.equal(
592592
isOrigin ? JSON.stringify(path[prop].toObject()) : path[prop],
593593
properties[i],

0 commit comments

Comments
 (0)