Skip to content

Commit e05eded

Browse files
committed
Typeof comparison should always use triple equality
1 parent f31f0e4 commit e05eded

7 files changed

+7
-7
lines changed

functions/array/array_merge_recursive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function array_merge_recursive (arr1, arr2) {
1818
} else if ((arr1 && (arr1 instanceof Object)) && (arr2 && (arr2 instanceof Object))) {
1919
for (idx in arr2) {
2020
if (idx in arr1) {
21-
if (typeof arr1[idx] == 'object' && typeof arr2 == 'object') {
21+
if (typeof arr1[idx] === 'object' && typeof arr2 === 'object') {
2222
arr1[idx] = this.array_merge(arr1[idx], arr2[idx]);
2323
} else {
2424
arr1[idx] = arr2[idx];

functions/funchand/call_user_func.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function call_user_func (cb) {
1111
func = (typeof this[cb] === 'function') ? this[cb] : func = (new Function(null, 'return ' + cb))();
1212
}
1313
else if (Object.prototype.toString.call(cb) === '[object Array]') {
14-
func = (typeof cb[0] == 'string') ? eval(cb[0] + "['" + cb[1] + "']") : func = cb[0][cb[1]];
14+
func = (typeof cb[0] === 'string') ? eval(cb[0] + "['" + cb[1] + "']") : func = cb[0][cb[1]];
1515
}
1616
else if (typeof cb === 'function') {
1717
func = cb;

functions/funchand/call_user_func_array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function call_user_func_array (cb, parameters) {
1515
func = (typeof this[cb] === 'function') ? this[cb] : func = (new Function(null, 'return ' + cb))();
1616
}
1717
else if (Object.prototype.toString.call(cb) === '[object Array]') {
18-
func = (typeof cb[0] == 'string') ? eval(cb[0] + "['" + cb[1] + "']") : func = cb[0][cb[1]];
18+
func = (typeof cb[0] === 'string') ? eval(cb[0] + "['" + cb[1] + "']") : func = cb[0][cb[1]];
1919
}
2020
else if (typeof cb === 'function') {
2121
func = cb;

functions/funchand/forward_static_call.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function forward_static_call (cb, parameters) {
88
var func;
99

1010
if (typeof cb === 'string') {
11-
if (typeof this[cb] == 'function') {
11+
if (typeof this[cb] === 'function') {
1212
func = this[cb];
1313
} else {
1414
func = (new Function(null, 'return ' + cb))();

functions/funchand/forward_static_call_array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function forward_static_call_array (cb, parameters) {
1010
var func;
1111

1212
if (typeof cb === 'string') {
13-
if (typeof this[cb] == 'function') {
13+
if (typeof this[cb] === 'function') {
1414
func = this[cb];
1515
} else {
1616
func = (new Function(null, 'return ' + cb))();

functions/url/base64_decode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function base64_decode (data) {
1313
// * returns 1: 'Kevin van Zonneveld'
1414
// mozilla has this native
1515
// - but breaks in 2.0.0.12!
16-
//if (typeof this.window['atob'] == 'function') {
16+
//if (typeof this.window['atob'] === 'function') {
1717
// return atob(data);
1818
//}
1919
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

functions/url/base64_encode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function base64_encode (data) {
1111
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
1212
// mozilla has this native
1313
// - but breaks in 2.0.0.12!
14-
//if (typeof this.window['btoa'] == 'function') {
14+
//if (typeof this.window['btoa'] === 'function') {
1515
// return btoa(data);
1616
//}
1717
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

0 commit comments

Comments
 (0)