trivial and outdated NPM packages

isarray outdated npm logo

Checks if a value is an array.

Weekly Downloads
85,996,167
Dependencies
0
Latest Release
6 years ago
Switch to the native implementation.
Outdated
natively supported
since 13 years (chrome, firefox, safari, nodejs)

About

This dependency checks if a value is an array.

To check if a value is an array, you can use the Array.isArray method:

Array.isArray is part of the ECMAScript standard and is widely supported in modern browsers and Node.js.

Array.isArray([]); // true

Array.isArray({}); // false
Array.isArray(null); // false
Array.isArray(undefined); // false
Array.isArray(123); // false
// etc.

Another way to check if a value is an array, is to use the instanceof operator, also widely supported:

[] instanceof Array; // true

({}) instanceof Array; // false
"foo" instanceof Array; // false
123 instanceof Array; // false
true instanceof Array; // false
// etc.

No need to use a dependency for this.