@zerodep/is-array
TypeScript icon, indicating that this package has built-in type declarations

2.0.12 • Public • Published

@zerodep/is-array

version language types license

CodeFactor Known Vulnerabilities

A simple, performant utility to determine if a value is an array.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

import { isArray } from '@zerodep/is-array';
// or
const { isArray } = require('@zerodep/is-array');

Positive Response

isArray([]); // true
isArray(['a', 'b', 'c']); // true

Negative Response

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

Readme

Keywords

Package Sidebar

Install

npm i @zerodep/is-array

Homepage

zerodep.app

Weekly Downloads

0

Version

2.0.12

License

MIT

Unpacked Size

4.27 kB

Total Files

7

Last publish

Collaborators

  • cdepage