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