array.isarray - npm

array.isarray

1.0.0 • Public • Published

array.isarray Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES spec-compliant Array.isArray shim/polyfill/replacement that works as far down as ES3.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Because Array.isArray depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument.

Example

var isArray = require('array.isarray');
var assert = require('assert');

assert.equal(isArray([1, 2, 3]), true);
assert.equal(isArray({ length: 0 }), false);
var isArray = require('array.isarray');
var assert = require('assert');
/* when Array.isArray is not present */
delete Array.isArray;
var shimmed = isArray.shim();
assert.equal(shimmed, isArray.getPolyfill());
assert.equal(shimmed, Array.isArray);
assert.equal(isArray([1, 2, 3]), Array.isArray([1, 2, 3]));
var isArray = require('array.isarray');
var assert = require('assert');
/* when Array.isArray is present */
var shimmed = isArray.shim();
assert.equal(shimmed, Array.isArray);
assert.deepEqual(Array.isArray([1, 2, 3]), isArray([1, 2, 3]));

Tests

Simply clone the repo, npm install, and run npm test

Package Sidebar

Install

npm i array.isarray

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

11.1 kB

Total Files

17

Last publish

Collaborators

  • ljharb

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.