Skip to content

Commit c470821

Browse files
committed
Use === instead of ==, even where an explicit String cast is required.
1 parent e2ffe40 commit c470821

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/css/Properties.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ var Properties = {
172172
valid = ValidationTypes.isAny(expression, simple);
173173
if (!valid) {
174174

175-
if (expression.peek() == "/" && count > 0 && !slash) {
175+
if (String(expression.peek()) === "/" && count > 0 && !slash) {
176176
slash = true;
177177
max = count + 5;
178178
expression.next();

src/css/Validation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ var Validation = {
8686
result = true;
8787

8888
} else if (comma) {
89-
if (expression.peek() == ",") {
89+
if (String(expression.peek()) === ",") {
9090
part = expression.next();
9191
} else {
9292
break;
@@ -104,7 +104,7 @@ var Validation = {
104104
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
105105
} else {
106106
part = expression.previous();
107-
if (comma && part == ",") {
107+
if (comma && String(part) === ",") {
108108
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
109109
} else {
110110
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);

src/css/ValidationTypes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ var ValidationTypes = {
9797
},
9898

9999
"<bg-image>": function(part){
100-
return this["<image>"](part) || this["<gradient>"](part) || part == "none";
100+
return this["<image>"](part) || this["<gradient>"](part) || String(part) === "none";
101101
},
102102

103103
"<gradient>": function(part) {
@@ -125,12 +125,12 @@ var ValidationTypes = {
125125
if (part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)){
126126
return true;
127127
}else{
128-
return part.type === "length" || part.type === "number" || part.type === "integer" || part == "0";
128+
return part.type === "length" || part.type === "number" || part.type === "integer" || String(part) === "0";
129129
}
130130
},
131131

132132
"<color>": function(part){
133-
return part.type === "color" || part == "transparent" || part == "currentColor";
133+
return part.type === "color" || String(part) === "transparent" || String(part) === "currentColor";
134134
},
135135

136136
"<number>": function(part){
@@ -158,7 +158,7 @@ var ValidationTypes = {
158158
},
159159

160160
"<percentage>": function(part){
161-
return part.type === "percentage" || part == "0";
161+
return part.type === "percentage" || String(part) === "0";
162162
},
163163

164164
"<border-width>": function(part){

0 commit comments

Comments
 (0)