source: imaps-frontend/node_modules/is-array-buffer/README.md@ d565449

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

Update repo after prototype presentation

  • Property mode set to 100644
File size: 2.3 KB
Line 
1# is-array-buffer <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 ArrayBuffer? 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 assert = require('assert');
16var isArrayBuffer = require('is-array-buffer');
17
18assert(!isArrayBuffer(function () {}));
19assert(!isArrayBuffer(null));
20assert(!isArrayBuffer(function* () { yield 42; return Infinity; });
21assert(!isArrayBuffer(Symbol('foo')));
22assert(!isArrayBuffer(1n));
23assert(!isArrayBuffer(Object(1n)));
24
25assert(!isArrayBuffer(new Set()));
26assert(!isArrayBuffer(new WeakSet()));
27assert(!isArrayBuffer(new Map()));
28assert(!isArrayBuffer(new WeakMap()));
29assert(!isArrayBuffer(new WeakRef({})));
30assert(!isArrayBuffer(new FinalizationRegistry(() => {})));
31assert(!isArrayBuffer(new SharedArrayBuffer()));
32
33assert(isArrayBuffer(new ArrayBuffer()));
34
35class MyArrayBuffer extends ArrayBuffer {}
36assert(isArrayBuffer(new MyArrayBuffer()));
37```
38
39## Tests
40Simply clone the repo, `npm install`, and run `npm test`
41
42[package-url]: https://npmjs.org/package/is-array-buffer
43[npm-version-svg]: https://versionbadg.es/inspect-js/is-array-buffer.svg
44[deps-svg]: https://david-dm.org/inspect-js/is-array-buffer.svg
45[deps-url]: https://david-dm.org/inspect-js/is-array-buffer
46[dev-deps-svg]: https://david-dm.org/inspect-js/is-array-buffer/dev-status.svg
47[dev-deps-url]: https://david-dm.org/inspect-js/is-array-buffer#info=devDependencies
48[npm-badge-png]: https://nodei.co/npm/is-array-buffer.png?downloads=true&stars=true
49[license-image]: https://img.shields.io/npm/l/is-array-buffer.svg
50[license-url]: LICENSE
51[downloads-image]: https://img.shields.io/npm/dm/is-array-buffer.svg
52[downloads-url]: https://npm-stat.com/charts.html?package=is-array-buffer
53[codecov-image]: https://codecov.io/gh/inspect-js/is-array-buffer/branch/main/graphs/badge.svg
54[codecov-url]: https://app.codecov.io/gh/inspect-js/is-array-buffer/
55[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-array-buffer
56[actions-url]: https://github.com/inspect-js/is-array-buffer/actions
Note: See TracBrowser for help on using the repository browser.