Skip to content

Commit bfb0eda

Browse files
committed
Typeof comparison should always use ===
1 parent b90ee41 commit bfb0eda

File tree

12 files changed

+16
-16
lines changed

12 files changed

+16
-16
lines changed

functions/_phpjs_shared/_phpjs_shared_bc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ function _phpjs_shared_bc () {
11181118
},
11191119

11201120
cint: function (v) {
1121-
if (typeof v == 'undefined') {
1121+
if (typeof v === 'undefined') {
11221122
v = 0;
11231123
}
11241124
var x = parseInt(v, 10);

functions/array/array_walk_recursive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ function array_walk_recursive (array, funcname, userdata) {
1212
}
1313

1414
for (key in array) {
15-
if (typeof array[key] == 'object') {
15+
if (typeof array[key] === 'object') {
1616
return this.array_walk_recursive(array[key], funcname, userdata);
1717
}
1818

19-
if (typeof userdata != 'undefined') {
19+
if (typeof userdata !== 'undefined') {
2020
eval(funcname + '( array [key] , key , userdata )');
2121
} else {
2222
eval(funcname + '( userdata ) ');

functions/bc/bcadd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function bcadd (left_operand, right_operand, scale) {
1515

1616
var first, second, result;
1717

18-
if (typeof scale == 'undefined') {
18+
if (typeof scale === 'undefined') {
1919
scale = libbcmath.scale;
2020
}
2121
scale = ((scale < 0) ? 0 : scale);

functions/bc/bccomp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function bccomp (left_operand, right_operand, scale) {
1414
var libbcmath = this._phpjs_shared_bc();
1515

1616
var first, second; //bc_num
17-
if (typeof scale == 'undefined') {
17+
if (typeof scale === 'undefined') {
1818
scale = libbcmath.scale;
1919
}
2020
scale = ((scale < 0) ? 0 : scale);

functions/bc/bcdiv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function bcdiv (left_operand, right_operand, scale) {
2020

2121
var first, second, result;
2222

23-
if (typeof scale == 'undefined') {
23+
if (typeof scale === 'undefined') {
2424
scale = libbcmath.scale;
2525
}
2626
scale = ((scale < 0) ? 0 : scale);

functions/bc/bcmul.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function bcmul (left_operand, right_operand, scale) {
1616

1717
var first, second, result;
1818

19-
if (typeof scale == 'undefined') {
19+
if (typeof scale === 'undefined') {
2020
scale = libbcmath.scale;
2121
}
2222
scale = ((scale < 0) ? 0 : scale);

functions/bc/bcsub.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function bcsub (left_operand, right_operand, scale) {
1717

1818
var first, second, result;
1919

20-
if (typeof scale == 'undefined') {
20+
if (typeof scale === 'undefined') {
2121
scale = libbcmath.scale;
2222
}
2323
scale = ((scale < 0) ? 0 : scale);

functions/datetime/getdate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function getdate (timestamp) {
77
// * returns 1: {'seconds': 40, 'minutes': 58, 'hours': 21, 'mday': 17, 'wday': 2, 'mon': 6, 'year': 2003, 'yday': 167, 'weekday': 'Tuesday', 'month': 'June', '0': 1055901520}
88
var _w = ['Sun', 'Mon', 'Tues', 'Wednes', 'Thurs', 'Fri', 'Satur'];
99
var _m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
10-
var d = ((typeof timestamp == 'undefined') ? new Date() : // Not provided
11-
(typeof timestamp == 'object') ? new Date(timestamp) : // Javascript Date()
10+
var d = ((typeof timestamp === 'undefined') ? new Date() : // Not provided
11+
(typeof timestamp === 'object') ? new Date(timestamp) : // Javascript Date()
1212
new Date(timestamp * 1000) // UNIX timestamp (auto-convert to int)
1313
);
1414
var w = d.getDay();

functions/datetime/gmstrftime.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ function gmstrftime (format, timestamp) {
66
// - depends on: strftime
77
// * example 1: gmstrftime("%A", 1062462400);
88
// * returns 1: 'Tuesday'
9-
var dt = ((typeof timestamp == 'undefined') ? new Date() : // Not provided
10-
(typeof timestamp == 'object') ? new Date(timestamp) : // Javascript Date()
9+
var dt = ((typeof timestamp === 'undefined') ? new Date() : // Not provided
10+
(typeof timestamp === 'object') ? new Date(timestamp) : // Javascript Date()
1111
new Date(timestamp * 1000) // UNIX timestamp (auto-convert to int)
1212
);
1313
timestamp = Date.parse(dt.toUTCString().slice(0, -4)) / 1000;

functions/datetime/strftime.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ OW
174174
Oy
175175
*/
176176

177-
var _date = ((typeof timestamp == 'undefined') ? new Date() : // Not provided
178-
(typeof timestamp == 'object') ? new Date(timestamp) : // Javascript Date()
177+
var _date = ((typeof timestamp === 'undefined') ? new Date() : // Not provided
178+
(typeof timestamp === 'object') ? new Date(timestamp) : // Javascript Date()
179179
new Date(timestamp * 1000) // PHP API expects UNIX timestamp (auto-convert to int)
180180
);
181181

functions/filesystem/basename.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function basename (path, suffix) {
1010
// * returns 2: 'ecra.php?p=1'
1111
var b = path.replace(/^.*[\/\\]/g, '');
1212

13-
if (typeof suffix == 'string' && b.substr(b.length - suffix.length) == suffix) {
13+
if (typeof suffix === 'string' && b.substr(b.length - suffix.length) == suffix) {
1414
b = b.substr(0, b.length - suffix.length);
1515
}
1616

functions/var/is_string.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ function is_string (mixed_var) {
55
// * returns 1: true
66
// * example 2: is_string(23.5);
77
// * returns 2: false
8-
return (typeof mixed_var == 'string');
8+
return (typeof mixed_var === 'string');
99
}

0 commit comments

Comments
 (0)