Skip to content

Get the ArrayBuffer out of a TypedArray, robustly.

License

Notifications You must be signed in to change notification settings

inspect-js/typed-array-buffer

This branch is up to date with main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Dec 18, 2024
348782b · Dec 18, 2024

History

28 Commits
Dec 17, 2024
Feb 20, 2024
Jun 5, 2023
Jun 5, 2023
Jun 5, 2023
Jun 5, 2023
Dec 18, 2024
Jun 5, 2023
Feb 20, 2024
Dec 17, 2024
Dec 17, 2024
Dec 18, 2024
Mar 9, 2024

Repository files navigation

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