Skip to content

Commit c788e74

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

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
@@ -171,7 +171,7 @@ var Properties = {
171171
valid = ValidationTypes.isAny(expression, simple);
172172
if (!valid) {
173173

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

src/css/Validation.js

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

7878
} else if (comma) {
79-
if (expression.peek() == ",") {
79+
if (String(expression.peek()) === ",") {
8080
part = expression.next();
8181
} else {
8282
break;
@@ -94,7 +94,7 @@ var Validation = {
9494
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
9595
} else {
9696
part = expression.previous();
97-
if (comma && part == ",") {
97+
if (comma && String(part) === ",") {
9898
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
9999
} else {
100100
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){
@@ -162,7 +162,7 @@ var ValidationTypes = {
162162
},
163163

164164
"<percentage>": function(part){
165-
return part.type === "percentage" || part == "0";
165+
return part.type === "percentage" || String(part) === "0";
166166
},
167167

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

0 commit comments

Comments
 (0)