is-typed-array (1.1.15)

Published 2026-02-24 13:58:41 +00:00 by atheaadmin

Installation

registry=
npm install is-typed-array@1.1.15
"is-typed-array": "1.1.15"

About this package

is-typed-array Version Badge

github actions coverage [![dependency status][5]][6] [![dev dependency status][7]][8] License Downloads

npm badge

Is this value a JS Typed Array? This module works cross-realm/iframe, does not depend on instanceof or mutable properties, and despite ES6 Symbol.toStringTag.

Example

var isTypedArray = require('is-typed-array');
var assert = require('assert');

assert.equal(false, isTypedArray(undefined));
assert.equal(false, isTypedArray(null));
assert.equal(false, isTypedArray(false));
assert.equal(false, isTypedArray(true));
assert.equal(false, isTypedArray([]));
assert.equal(false, isTypedArray({}));
assert.equal(false, isTypedArray(/a/g));
assert.equal(false, isTypedArray(new RegExp('a', 'g')));
assert.equal(false, isTypedArray(new Date()));
assert.equal(false, isTypedArray(42));
assert.equal(false, isTypedArray(NaN));
assert.equal(false, isTypedArray(Infinity));
assert.equal(false, isTypedArray(new Number(42)));
assert.equal(false, isTypedArray('foo'));
assert.equal(false, isTypedArray(Object('foo')));
assert.equal(false, isTypedArray(function () {}));
assert.equal(false, isTypedArray(function* () {}));
assert.equal(false, isTypedArray(x => x * x));
assert.equal(false, isTypedArray([]));

assert.ok(isTypedArray(new Int8Array()));
assert.ok(isTypedArray(new Uint8Array()));
assert.ok(isTypedArray(new Uint8ClampedArray()));
assert.ok(isTypedArray(new Int16Array()));
assert.ok(isTypedArray(new Uint16Array()));
assert.ok(isTypedArray(new Int32Array()));
assert.ok(isTypedArray(new Uint32Array()));
assert.ok(isTypedArray(new Float32Array()));
assert.ok(isTypedArray(new Float64Array()));
assert.ok(isTypedArray(new BigInt64Array()));
assert.ok(isTypedArray(new BigUint64Array()));

Tests

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

Dependencies

Dependencies

ID Version
which-typed-array ^1.1.16

Development Dependencies

ID Version
@arethetypeswrong/cli ^0.17.1
@ljharb/eslint-config ^21.1.1
@ljharb/tsconfig ^0.2.2
@types/for-each ^0.3.3
@types/is-callable ^1.1.2
@types/make-arrow-function ^1.2.2
@types/make-generator-function ^2.0.3
@types/node ^20.17.10
@types/object-inspect ^1.13.0
@types/tape ^5.8.0
auto-changelog ^2.5.0
encoding ^0.1.13
eslint =8.8.0
evalmd ^0.0.19
for-each ^0.3.3
has-tostringtag ^1.0.2
in-publish ^2.0.1
is-callable ^1.2.7
make-arrow-function ^1.2.0
make-generator-function ^2.0.0
npmignore ^0.3.1
nyc ^10.3.2
object-inspect ^1.13.3
safe-publish-latest ^2.0.0
tape ^5.9.0
typescript next

Keywords

array TypedArray typed array is typed Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array ES6 toStringTag Symbol.toStringTag @@toStringTag
Details
npm
2026-02-24 13:58:41 +00:00
1
Jordan Harband
MIT
latest
7.3 KiB
Assets (1)
Versions (1) View all
1.1.15 2026-02-24