source: imaps-frontend/node_modules/is-typed-array/README.md

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 3.0 KB
Line 
1# is-typed-array <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
3[![github actions][actions-image]][actions-url]
4[![coverage][codecov-image]][codecov-url]
5[![dependency status][5]][6]
6[![dev dependency status][7]][8]
7[![License][license-image]][license-url]
8[![Downloads][downloads-image]][downloads-url]
9
10[![npm badge][npm-badge-png]][package-url]
11
12Is 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.
13
14## Example
15
16```js
17var isTypedArray = require('is-typed-array');
18var assert = require('assert');
19
20assert.equal(false, isTypedArray(undefined));
21assert.equal(false, isTypedArray(null));
22assert.equal(false, isTypedArray(false));
23assert.equal(false, isTypedArray(true));
24assert.equal(false, isTypedArray([]));
25assert.equal(false, isTypedArray({}));
26assert.equal(false, isTypedArray(/a/g));
27assert.equal(false, isTypedArray(new RegExp('a', 'g')));
28assert.equal(false, isTypedArray(new Date()));
29assert.equal(false, isTypedArray(42));
30assert.equal(false, isTypedArray(NaN));
31assert.equal(false, isTypedArray(Infinity));
32assert.equal(false, isTypedArray(new Number(42)));
33assert.equal(false, isTypedArray('foo'));
34assert.equal(false, isTypedArray(Object('foo')));
35assert.equal(false, isTypedArray(function () {}));
36assert.equal(false, isTypedArray(function* () {}));
37assert.equal(false, isTypedArray(x => x * x));
38assert.equal(false, isTypedArray([]));
39
40assert.ok(isTypedArray(new Int8Array()));
41assert.ok(isTypedArray(new Uint8Array()));
42assert.ok(isTypedArray(new Uint8ClampedArray()));
43assert.ok(isTypedArray(new Int16Array()));
44assert.ok(isTypedArray(new Uint16Array()));
45assert.ok(isTypedArray(new Int32Array()));
46assert.ok(isTypedArray(new Uint32Array()));
47assert.ok(isTypedArray(new Float32Array()));
48assert.ok(isTypedArray(new Float64Array()));
49assert.ok(isTypedArray(new BigInt64Array()));
50assert.ok(isTypedArray(new BigUint64Array()));
51```
52
53## Tests
54Simply clone the repo, `npm install`, and run `npm test`
55
56[package-url]: https://npmjs.org/package/is-typed-array
57[npm-version-svg]: https://versionbadg.es/inspect-js/is-typed-array.svg
58[deps-svg]: https://david-dm.org/inspect-js/is-typed-array.svg
59[deps-url]: https://david-dm.org/inspect-js/is-typed-array
60[dev-deps-svg]: https://david-dm.org/inspect-js/is-typed-array/dev-status.svg
61[dev-deps-url]: https://david-dm.org/inspect-js/is-typed-array#info=devDependencies
62[npm-badge-png]: https://nodei.co/npm/is-typed-array.png?downloads=true&stars=true
63[license-image]: https://img.shields.io/npm/l/is-typed-array.svg
64[license-url]: LICENSE
65[downloads-image]: https://img.shields.io/npm/dm/is-typed-array.svg
66[downloads-url]: https://npm-stat.com/charts.html?package=is-typed-array
67[codecov-image]: https://codecov.io/gh/inspect-js/is-typed-array/branch/main/graphs/badge.svg
68[codecov-url]: https://app.codecov.io/gh/inspect-js/is-typed-array/
69[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-typed-array
70[actions-url]: https://github.com/inspect-js/is-typed-array/actions
Note: See TracBrowser for help on using the repository browser.