Huge news!Announcing our $20M Series A led by Andreessen Horowitz.Learn more
Socket
Socket
Log inDemoInstall

is-array-buffer

Package Overview
Dependencies
16
Maintainers
2
Versions
8
Issues
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

is-array-buffer

Is this value a JS ArrayBuffer?

    3.0.2latest
    GitHub
    npm

Version published
Maintainers
2
Weekly downloads
19,445,047
decreased by-8.36%

Weekly downloads

Changelog

Source

v3.0.2 - 2023-03-01

Commits

  • [Fix] node 0.8: an object arg to a TA only throws a RangeError when it is an ArrayBuffer of an incompatible byte length d5108f6
  • [Dev Deps] update object-inspect, tape 400f456
  • [Deps] update get-intrinsic 133732e

Readme

Source

is-array-buffer Version Badge

github actions coverage License Downloads

npm badge

Is this value a JS ArrayBuffer? 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 isArrayBuffer = require('is-array-buffer');

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

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

assert(isArrayBuffer(new ArrayBuffer()));

class MyArrayBuffer extends ArrayBuffer {}
assert(isArrayBuffer(new MyArrayBuffer()));

Tests

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

Keywords

FAQs

Last updated on 02 Mar 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install
SocketSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc