basant307/AI_Governance_Project
048
1# is-shared-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 SharedArrayBuffer? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and despite ES6 Symbol.toStringTag.11 12## Example13 14```js15var assert = require('assert');16var isSharedArrayBuffer = require('is-shared-array-buffer');17 18assert(!isSharedArrayBuffer(function () {}));19assert(!isSharedArrayBuffer(null));20assert(!isSharedArrayBuffer(function* () { yield 42; return Infinity; });21assert(!isSharedArrayBuffer(Symbol('foo')));22assert(!isSharedArrayBuffer(1n));23assert(!isSharedArrayBuffer(Object(1n)));24 25assert(!isSharedArrayBuffer(new Set()));26assert(!isSharedArrayBuffer(new WeakSet()));27assert(!isSharedArrayBuffer(new Map()));28assert(!isSharedArrayBuffer(new WeakMap()));29assert(!isSharedArrayBuffer(new WeakRef({})));30assert(!isSharedArrayBuffer(new FinalizationRegistry(() => {})));31assert(!isSharedArrayBuffer(new ArrayBuffer()));32 33assert(isSharedArrayBuffer(new SharedArrayBuffer()));34 35class MySharedArrayBuffer extends SharedArrayBuffer {}36assert(isSharedArrayBuffer(new MySharedArrayBuffer()));37```38 39## Tests40Simply clone the repo, `npm install`, and run `npm test`41 42[package-url]: https://npmjs.org/package/is-shared-array-buffer43[npm-version-svg]: https://versionbadg.es/inspect-js/is-shared-array-buffer.svg44[deps-svg]: https://david-dm.org/inspect-js/is-shared-array-buffer.svg45[deps-url]: https://david-dm.org/inspect-js/is-shared-array-buffer46[dev-deps-svg]: https://david-dm.org/inspect-js/is-shared-array-buffer/dev-status.svg47[dev-deps-url]: https://david-dm.org/inspect-js/is-shared-array-buffer#info=devDependencies48[npm-badge-png]: https://nodei.co/npm/is-shared-array-buffer.png?downloads=true&stars=true49[license-image]: https://img.shields.io/npm/l/is-shared-array-buffer.svg50[license-url]: LICENSE51[downloads-image]: https://img.shields.io/npm/dm/is-shared-array-buffer.svg52[downloads-url]: https://npm-stat.com/charts.html?package=is-shared-array-buffer53[codecov-image]: https://codecov.io/gh/inspect-js/is-shared-array-buffer/branch/main/graphs/badge.svg54[codecov-url]: https://app.codecov.io/gh/inspect-js/is-shared-array-buffer/55[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-shared-array-buffer56[actions-url]: https://github.com/inspect-js/is-shared-array-buffer/actions57 