A simple, performant utility to determine if a value is an array.
Full documentation is available at the zerodep.app page.
All @zerodep packages support both ESM and CJS.
import { isArray } from '@zerodep/is-array';
// or
const { isArray } = require('@zerodep/is-array');
isArray([]); // true
isArray(['a', 'b', 'c']); // true
isArray(1000n); // false
isArray(true); // false
isArray(new Date()); // false
isArray(''); // false
isArray(new Error('message')); // false
isArray(3.14); // false
isArray(() => 'function'); // false
isArray(42); // false
isArray(
new Map([
['a', 1],
['b', 2],
])
); // false
isArray(null); // false
isArray({ an: 'object' }); // false
isArray(new Promise(() => {})); // false
isArray(/[regex]+/gi); // false
isArray(new Set([1, 2, 3])); // false
isArray('a string'); // false
isArray(Symbol()); // false
isArray(new Int32Array(2)); // false
isArray(undefined); // false