Package detail

is-shared-array-buffer

inspect-js159.2mMIT1.0.4

Is this value a JS SharedArrayBuffer?

javascript, ecmascript, is, sharedarraybuffer

readme

is-shared-array-buffer Version Badge

github actions coverage License Downloads

npm badge

Is this value a JS SharedArrayBuffer? This module works cross-realm/iframe, does not depend on instanceof or mutable properties, and despite ES6 Symbol.toStringTag.

Example

var assert = require('assert');
var isSharedArrayBuffer = require('is-shared-array-buffer');

assert(!isSharedArrayBuffer(function () {}));
assert(!isSharedArrayBuffer(null));
assert(!isSharedArrayBuffer(function* () { yield 42; return Infinity; });
assert(!isSharedArrayBuffer(Symbol('foo')));
assert(!isSharedArrayBuffer(1n));
assert(!isSharedArrayBuffer(Object(1n)));

assert(!isSharedArrayBuffer(new Set()));
assert(!isSharedArrayBuffer(new WeakSet()));
assert(!isSharedArrayBuffer(new Map()));
assert(!isSharedArrayBuffer(new WeakMap()));
assert(!isSharedArrayBuffer(new WeakRef({})));
assert(!isSharedArrayBuffer(new FinalizationRegistry(() => {})));
assert(!isSharedArrayBuffer(new ArrayBuffer()));

assert(isSharedArrayBuffer(new SharedArrayBuffer()));

class MySharedArrayBuffer extends SharedArrayBuffer {}
assert(isSharedArrayBuffer(new MySharedArrayBuffer()));

Tests

Simply clone the repo, npm install, and run npm test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.0.4 - 2024-12-18

Commits

  • [types] use shared config 2966419
  • [actions] split out node 10-20, and 20+ 9961138
  • [Dev Deps] update @arethetypeswrong/cli, @ljharb/eslint-config, @ljharb/tsconfig, @types/node, @types/object-inspect, @types/tape auto-changelog, es-value-fixtures, object-inspect, tape a808a5d
  • [Refactor] use call-bound directly 5235143
  • [Tests] replace aud with npm audit 954a0c7
  • [Tests] use @arethetypeswrong/cli 0ba297a
  • [Deps] update call-bind d5c5bab
  • [Dev Deps] update @types/node 705f5c7
  • [Dev Deps] add missing peer dep 4123434

v1.0.3 - 2024-02-20

Commits

  • [meta] use npmignore to autogenerate an npmignore file c4131f5
  • add types 41cb419
  • [actions] skip ls check on node < 10; remove redundant finisher 2655b01
  • [Dev Deps] update @ljharb/eslint-config, aud, available-typed-arrays, npmignore, object-inspect, tape 5917f9a
  • [Tests] add tests that TypedArrays are not SABs 823dd7a
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, es-value-fixtures, object-inspect, tape 6701ad4
  • [actions] update rebase action to use reusable workflow b5119f0
  • [Dev Deps] update @ljharb/eslint-config, aud 38a6d72
  • [meta] add missing engines.node aac97e1
  • [readme] remove dead badges 07c452d
  • [Deps] update call-bind b8576fe
  • [meta] add sideEffects flag 3e6730e

v1.0.2 - 2022-04-01

Commits

  • [actions] reuse common workflows 48d01e6
  • [actions] use node/install instead of node/run; use codecov action 7b0e12a
  • [Dev Deps] update eslint, @ljharb/eslint-config, object-inspect, safe-publish-latest, tape 8d57a8e
  • [readme] update URLs dca4d27
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, object-inspect, tape 2a7bb99
  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog, object-inspect, safe-publish-latest, tape 389c6db
  • [actions] update codecov uploader b9661f9
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, object-inspect f99cd48
  • [readme] add actions and codecov badges 9515ed2
  • [Fix] add missing call-bind dependency cff5358
  • [meta] add safe-publish-latest; use prepublishOnly script for npm 7+ ba0b719

v1.0.1 - 2021-03-04

Commits

v1.0.0 - 2021-03-04

Commits

  • [Tests] add tests 9c7b806
  • Initial commit 4e65c5e
  • [meta] do not publish github action workflow files ac3693d
  • readme 7a984d0
  • npm init a586c99
  • [actions] add automatic rebasing / merge commit blocking 184fe62
  • Implementation 207e26d
  • [meta] create FUNDING.yml; add "funding" field 3cad3fc
  • [meta] add auto-changelog 31f1f2c
  • [Tests] add npm run lint 2e5146e
  • Only apps should have lockfiles 7b2adfa