typed-array-buffer

Get the ArrayBuffer out of a TypedArray, robustly.

MIT 4 个版本
安装
npm install typed-array-buffer
yarn add typed-array-buffer
pnpm add typed-array-buffer
bun add typed-array-buffer
README

typed-array-buffer Version Badge

github actions coverage License Downloads

npm badge

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.

Example

const typedArrayBuffer = require('typed-array-buffer');
const assert = require('assert');

const arr = new Uint8Array(0);
assert.equal(arr.buffer, typedArrayBuffer(arr));

Tests

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

版本列表
1.0.3 2024-12-18
1.0.2 2024-02-20
1.0.1 2024-02-06
1.0.0 2023-06-05