You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lucas DELANIER f6b88ca349
first commit
12 months ago
..
.github first commit 12 months ago
test first commit 12 months ago
.eslintrc first commit 12 months ago
.nycrc first commit 12 months ago
CHANGELOG.md first commit 12 months ago
LICENSE first commit 12 months ago
README.md first commit 12 months ago
index.d.ts first commit 12 months ago
index.js first commit 12 months ago
package.json first commit 12 months ago
tsconfig.json first commit 12 months ago

README.md

data-view-byte-length Version Badge

github actions coverage License Downloads

npm badge

Get the byteLength out of a DataView, robustly.

This will work in node <= 0.10 and < 0.11.4, where there's no prototype accessor, only a nonconfigurable own property. It will also work in modern engines where DataView.prototype.byteLength has been deleted after this module has loaded.

Example

const dataViewByteLength = require('data-view-byte-length');
const assert = require('assert');

const ab = new ArrayBuffer(42);
const dv = new DataView(ab);
assert.equal(dataViewByteLength(dv), 42);

Tests

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