Skip to content

Latest commit

 

History

History
21 lines (13 loc) · 357 Bytes

no-array-instanceof.md

File metadata and controls

21 lines (13 loc) · 357 Bytes

Require Array.isArray() instead of instanceof Array

The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.

This rule is fixable.

Fail

array instanceof Array;
[1,2,3] instanceof Array;

Pass

Array.isArray(array);
Array.isArray([1,2,3]);