|
|
1 year ago | |
|---|---|---|
| .. | ||
| .github | 1 year ago | |
| test | 1 year ago | |
| .eslintrc | 1 year ago | |
| .nycrc | 1 year ago | |
| CHANGELOG.md | 1 year ago | |
| LICENSE | 1 year ago | |
| README.md | 1 year ago | |
| index.js | 1 year ago | |
| package.json | 1 year ago | |
Get the ArrayBuffer out of a TypedArray, 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 TypedArray.prototype.buffer has been deleted after this module has loaded.
const typedArrayBuffer = require('typed-array-buffer');
const assert = require('assert');
const arr = new Uint8Array(0);
assert.equal(arr.buffer, typedArrayBuffer(arr));
Simply clone the repo, npm install, and run npm test