meteor-node-stubs
Version:
Stub implementations of Node built-in modules, a la Browserify
71 lines (61 loc) • 3.12 kB
Markdown
5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
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.
```js
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()));
```
Simply clone the repo, `npm install`, and run `npm test`
[ ]: https://npmjs.org/package/is-typed-array
[ ]: https://versionbadg.es/inspect-js/is-typed-array.svg
[ ]: https://david-dm.org/inspect-js/is-typed-array.svg
[ ]: https://david-dm.org/inspect-js/is-typed-array
[ ]: https://david-dm.org/inspect-js/is-typed-array/dev-status.svg
[ ]: https://david-dm.org/inspect-js/is-typed-array#info=devDependencies
[ ]: https://nodei.co/npm/is-typed-array.png?downloads=true&stars=true
[ ]: https://img.shields.io/npm/l/is-typed-array.svg
[ ]: LICENSE
[ ]: https://img.shields.io/npm/dm/is-typed-array.svg
[ ]: https://npm-stat.com/charts.html?package=is-typed-array
[ ]: https://codecov.io/gh/inspect-js/is-typed-array/branch/main/graphs/badge.svg
[ ]: https://app.codecov.io/gh/inspect-js/is-typed-array/
[ ]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-typed-array
[ ]: https://github.com/inspect-js/is-typed-array/actions
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][