# which-typed-array

> Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.

Latest version **1.1.23** (published 2026-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install which-typed-array
pnpm add which-typed-array
yarn add which-typed-array
bun add which-typed-array
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.23 |
| Published | 2026-09-16 |
| First published | 2015-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | array, TypedArray, typed array, which, typed, Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ES6, toStringTag, Symbol.toStringTag, @@toStringTag |

## Links

- npm: https://www.npmjs.com/package/which-typed-array
- Repository: https://github.com/inspect-js/which-typed-array
- Homepage: https://github.com/inspect-js/which-typed-array#readme
- Issues: https://github.com/inspect-js/which-typed-array/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/which-typed-array

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.1.23 (latest) — 2026-09-16
- 1.1.22 — 2026-06-05
- 1.1.21 — 2026-05-26
- 1.1.20 — 2026-01-14
- 1.1.19 — 2025-03-09
- 1.1.18 — 2024-12-18
- 1.1.17 — 2024-12-18
- 1.1.16 — 2024-11-27
- 1.1.15 — 2024-03-11
- 1.1.14 — 2024-02-01
- 1.1.13 — 2023-10-20
- 1.1.12 — 2023-10-19
- 1.1.11 — 2023-07-18
- 1.1.10 — 2023-07-10
- 1.1.9 — 2022-11-02
- … 11 more at https://npm.io/package/which-typed-array/versions

## README

# which-typed-array <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.

## Example

```js
var whichTypedArray = require('which-typed-array');
var assert = require('assert');

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

assert.equal('Int8Array', whichTypedArray(new Int8Array()));
assert.equal('Uint8Array', whichTypedArray(new Uint8Array()));
assert.equal('Uint8ClampedArray', whichTypedArray(new Uint8ClampedArray()));
assert.equal('Int16Array', whichTypedArray(new Int16Array()));
assert.equal('Uint16Array', whichTypedArray(new Uint16Array()));
assert.equal('Int32Array', whichTypedArray(new Int32Array()));
assert.equal('Uint32Array', whichTypedArray(new Uint32Array()));
assert.equal('Float32Array', whichTypedArray(new Float32Array()));
assert.equal('Float64Array', whichTypedArray(new Float64Array()));
assert.equal('BigInt64Array', whichTypedArray(new BigInt64Array()));
assert.equal('BigUint64Array', whichTypedArray(new BigUint64Array()));
```

## Tests
Simply clone the repo, `npm install`, and run `npm test`

[package-url]: https://npmjs.org/package/which-typed-array
[npm-version-svg]: https://versionbadg.es/inspect-js/which-typed-array.svg
[deps-svg]: https://david-dm.org/inspect-js/which-typed-array.svg
[deps-url]: https://david-dm.org/inspect-js/which-typed-array
[dev-deps-svg]: https://david-dm.org/inspect-js/which-typed-array/dev-status.svg
[dev-deps-url]: https://david-dm.org/inspect-js/which-typed-array#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/which-typed-array.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/which-typed-array.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/which-typed-array.svg
[downloads-url]: https://npm-stat.com/charts.html?package=which-typed-array
[codecov-image]: https://codecov.io/gh/inspect-js/which-typed-array/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/which-typed-array/
[actions-image]: https://img.shields.io/github/check-runs/inspect-js/which-typed-array/main
[actions-url]: https://github.com/inspect-js/which-typed-array/actions

---
_Source: https://npm.io/package/which-typed-array · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
