Skip to content

Commit f31f0e4

Browse files
committed
Merge pull request locutusjs#95 from tersmitten/typeof-is-not-a-function
Typeof is not a function
2 parents 6b555c5 + bfb0eda commit f31f0e4

22 files changed

+28
-28
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_count_values.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function array_count_values (array) {
2727
};
2828

2929
var __countValue = function (value) {
30-
switch (typeof(value)) {
30+
switch (typeof value) {
3131
case "number":
3232
if (Math.floor(value) !== value) {
3333
return;

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: 3 additions & 3 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

@@ -209,7 +209,7 @@ Oy
209209
return _date[f]();
210210
} else if (typeof f === 'function') {
211211
return f(_date);
212-
} else if (typeof f === 'object' && typeof(f[0]) === 'string') {
212+
} else if (typeof f === 'object' && typeof f[0] === 'string') {
213213
return _xPad(_date[f[0]](), f[1]);
214214
} else { // Shouldn't reach here
215215
return m1;

functions/datetime/strtotime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function strtotime (text, now) {
6969
function lastNext(type, range, modifier) {
7070
var day = days[range];
7171

72-
if (typeof(day) !== 'undefined') {
72+
if (typeof day !== 'undefined') {
7373
var diff = day - date.getDay();
7474

7575
if (diff === 0)

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/language/require.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function require (filename) {
2323
script_block.appendChild(d.createTextNode(js_code));
2424
}
2525

26-
if (typeof(script_block) !== 'undefined') {
26+
if (typeof script_block !== 'undefined') {
2727
d.getElementsByTagNameNS && isXML ? (d.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'head')[0] ? d.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'head')[0].appendChild(script_block) : d.documentElement.insertBefore(script_block, d.documentElement.firstChild) // in case of XUL
2828
) : d.getElementsByTagName('head')[0].appendChild(script_block);
2929

functions/misc/pack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function pack (format) {
7979
for (i = 0; i < quantifier; i += 2) {
8080
// Always get per 2 bytes...
8181
word = argument[i];
82-
if (((i + 1) >= quantifier) || typeof(argument[i + 1]) === 'undefined') {
82+
if (((i + 1) >= quantifier) || typeof argument[i + 1] === 'undefined') {
8383
word += '0';
8484
} else {
8585
word += argument[i + 1];

functions/network/setrawcookie.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function setrawcookie (name, value, expires, path, domain, secure) {
1313

1414
if (expires instanceof Date) {
1515
expires = expires.toGMTString();
16-
} else if (typeof(expires) === 'number') {
16+
} else if (typeof expires === 'number') {
1717
expires = (new Date(expires * 1e3)).toGMTString();
1818
}
1919

functions/strings/implode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function implode (glue, pieces) {
1515
pieces = glue;
1616
glue = '';
1717
}
18-
if (typeof(pieces) === 'object') {
18+
if (typeof pieces === 'object') {
1919
if (Object.prototype.toString.call(pieces) === '[object Array]') {
2020
return pieces.join(glue);
2121
}

functions/url/http_build_query.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ function http_build_query (formdata, numeric_prefix, arg_separator) {
2626
val = "0";
2727
}
2828
if (val != null) {
29-
if(typeof(val) === "object") {
29+
if(typeof val === "object") {
3030
for (k in val) {
3131
if (val[k] != null) {
3232
tmp.push(_http_build_query_helper(key + "[" + k + "]", val[k], arg_separator));
3333
}
3434
}
3535
return tmp.join(arg_separator);
36-
} else if (typeof(val) !== "function") {
36+
} else if (typeof val !== "function") {
3737
return that.urlencode(key) + "=" + that.urlencode(val);
3838
} else {
3939
throw new Error('There was an error processing for http_build_query().');

functions/var/intval.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function intval (mixed_var, base) {
1818
// * returns 5: 30
1919
var tmp;
2020

21-
var type = typeof(mixed_var);
21+
var type = typeof mixed_var;
2222

2323
if (type === 'boolean') {
2424
return +mixed_var;

functions/var/is_numeric.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ function is_numeric (mixed_var) {
1616
// * returns 4: false
1717
// * example 4: is_numeric([]);
1818
// * returns 4: false
19-
return (typeof(mixed_var) === 'number' || typeof(mixed_var) === 'string') && mixed_var !== '' && !isNaN(mixed_var);
19+
return (typeof mixed_var === 'number' || typeof mixed_var === 'string') && mixed_var !== '' && !isNaN(mixed_var);
2020
}

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
}

functions/xdiff/xdiff_string_patch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function xdiff_string_patch (originalStr, patch, flags, error) {
172172
newStrArr[newStrArr.length] = origLines[linePos++];
173173
}
174174
}
175-
if (typeof(error) === 'string') {
175+
if (typeof error === 'string') {
176176
this.window[error] = errors;
177177
}
178178
return newStrArr.join('\n');

0 commit comments

Comments
 (0)