NPM Smell 🍑💨

trivial and outdated NPM packages

isarray outdated npm logo

Checks if a value is an array.

Weekly Downloads
97,184,436
Dependencies
0
Latest Release
5 years ago
This dependency re-creates a native JavaScript API. It is recommended to use the native API instead
Outdated
natively supported
since 11 years (chrome, firefox, safari, nodejs)

About

This dependency checks if you’re dealing with an array.

To check if you’re dealing with 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.