Prefer Array.isArray() to "instanceof Array" tests
This commit is contained in:
parent
80befd60eb
commit
cfeb46ef62
|
@ -33,7 +33,7 @@ $(document).ready(function () {
|
|||
console.log(JSON.stringify(e));
|
||||
if (e.type === "message"
|
||||
&& e.message[0] === "broker"
|
||||
&& e.message[2] instanceof Array
|
||||
&& Array.isArray(e.message[2])
|
||||
&& e.message[2][0] === "multidom"
|
||||
&& e.message[2][1] === "jQuery")
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ DOMFragment.prototype.handleEvent = function (e) {
|
|||
};
|
||||
|
||||
function isAttributes(x) {
|
||||
return (x instanceof Array) && ((x.length === 0) || (x[0] instanceof Array));
|
||||
return Array.isArray(x) && ((x.length === 0) || Array.isArray(x[0]));
|
||||
}
|
||||
|
||||
DOMFragment.prototype.interpretSpec = function (spec) {
|
||||
|
|
|
@ -355,7 +355,7 @@ World.prototype.textProcessTree = function (ownPid) {
|
|||
var lines = [];
|
||||
|
||||
function dumpProcess(prefix, pid, p) {
|
||||
if (p instanceof Array) {
|
||||
if (Array.isArray(p)) {
|
||||
lines.push(prefix + '--+ ' + pid);
|
||||
for (var i = 0; i < p.length; i++) {
|
||||
dumpProcess(prefix + ' |', p[i][0], p[i][1]);
|
||||
|
|
Loading…
Reference in New Issue