caoge c760052ff9 机车状态修改 | 8 months ago | |
---|---|---|
.. | ||
.github | 8 months ago | |
test | 8 months ago | |
.eslintrc | 8 months ago | |
.nycrc | 8 months ago | |
CHANGELOG.md | 8 months ago | |
LICENSE | 8 months ago | |
README.md | 8 months ago | |
index.js | 8 months ago | |
package.json | 8 months 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