Prefer Array.isArray() to "instanceof Array" tests

This commit is contained in:
Tony Garnock-Jones 2014-07-24 20:02:00 -07:00
parent 80befd60eb
commit cfeb46ef62
3 changed files with 3 additions and 3 deletions

View File

@ -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")
{

View File

@ -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) {

View File

@ -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]);