Bakhtina Sofya b84cb877be 1st comm | il y a 2 semaines | |
---|---|---|
.. | ||
.github | il y a 2 semaines | |
test | il y a 2 semaines | |
.eslintrc | il y a 2 semaines | |
.nycrc | il y a 2 semaines | |
CHANGELOG.md | il y a 2 semaines | |
LICENSE | il y a 2 semaines | |
README.md | il y a 2 semaines | |
index.d.ts | il y a 2 semaines | |
index.js | il y a 2 semaines | |
package.json | il y a 2 semaines | |
tsconfig.json | il y a 2 semaines |
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