Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

array-buffer-byte-length

inspect-js96.3mMIT1.0.2TypeScript support: included

Get the byte length of an ArrayBuffer, even in engines without a .byteLength method.

shim, polyfill, ArrayBuffer, byteLength, byte, length, es-shim API, es-shims

readme

array-buffer-byte-length Version Badge

github actions coverage License Downloads

npm badge

Get the byte length of an ArrayBuffer, even in engines without a .byteLength method.

Example

const assert = require('assert');
const byteLength = require('array-buffer-byte-length');

assert.equal(byteLength([]), NaN, 'an array is not an ArrayBuffer, yields NaN');

assert.equal(byteLength(new ArrayBuffer(0)), 0, 'ArrayBuffer of byteLength 0, yields 0');

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.2 - 2024-12-19

Commits

  • [types] use shared config b15321c
  • [actions] split out node 10-20, and 20+ fa1eb7d
  • [Dev Deps] update @ljharb/eslint-config, @ljharb/tsconfig, @types/object-inspect, @types/tape, auto-changelog, es-value-fixtures, object-inspect, tape 53e3f93
  • [Tests] replace aud with npm audit 2d1b66f
  • [Refactor] use call-bound directly 433be34
  • [Deps] update call-bind, is-array-buffer 4ff7467
  • [Dev Deps] update tape, typescript 42c9f19
  • [Tests] add attw 29a72f1
  • [Deps] update call-bind 1e9e902
  • [types] remove incorrect overload b509518
  • [Dev Deps] add missing peer dep 31962b6

v1.0.1 - 2024-02-03

Commits

  • [patch] add types 598d446
  • [Dev Deps] update @ljharb/eslint-config, aud, npmignore, object-inspect, tape 2572345
  • [Tests] add coverage d27357d
  • [Deps] update call-bind, is-array-buffer 2ea13ad
  • [meta] add missing engines.node 380e96d
  • [Deps] update is-array-buffer cfa7093
  • [meta] add sideEffects flag 7297ddd

v1.0.0 - 2023-02-28

Commits