|  | před 1 rokem | |
|---|---|---|
| .. | ||
| .github | před 1 rokem | |
| test | před 1 rokem | |
| .eslintrc | před 1 rokem | |
| .nycrc | před 1 rokem | |
| CHANGELOG.md | před 1 rokem | |
| LICENSE | před 1 rokem | |
| README.md | před 1 rokem | |
| index.js | před 1 rokem | |
| package.json | před 1 rokem | |
Get the byte length of an ArrayBuffer, even in engines without a .byteLength method.
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');
Simply clone the repo, npm install, and run npm test