travel/admin/node_modules/array-buffer-byte-length
yaosen 242417d45d init... 2024-06-24 11:28:18 +08:00
..
.github init... 2024-06-24 11:28:18 +08:00
test init... 2024-06-24 11:28:18 +08:00
.eslintrc init... 2024-06-24 11:28:18 +08:00
.nycrc init... 2024-06-24 11:28:18 +08:00
CHANGELOG.md init... 2024-06-24 11:28:18 +08:00
LICENSE init... 2024-06-24 11:28:18 +08:00
README.md init... 2024-06-24 11:28:18 +08:00
index.d.ts init... 2024-06-24 11:28:18 +08:00
index.js init... 2024-06-24 11:28:18 +08:00
package.json init... 2024-06-24 11:28:18 +08:00
tsconfig.json init... 2024-06-24 11:28:18 +08:00

README.md

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