3e2cfc185071f8e74f39b6c9ec788948a73161f1fe59cb97581b25e2ddf7f19f6b4020cc82785c5e48f1e2bae8dcac5ef431f19fda646b2602ea792cae45a5 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # typed-array-buffer <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
  2. [![github actions][actions-image]][actions-url]
  3. [![coverage][codecov-image]][codecov-url]
  4. [![License][license-image]][license-url]
  5. [![Downloads][downloads-image]][downloads-url]
  6. [![npm badge][npm-badge-png]][package-url]
  7. Get the ArrayBuffer out of a TypedArray, robustly.
  8. This will work in node <= 0.10 and < 0.11.4, where there's no prototype accessor, only a nonconfigurable own property.
  9. It will also work in modern engines where `TypedArray.prototype.buffer` has been deleted after this module has loaded.
  10. ## Example
  11. ```js
  12. const typedArrayBuffer = require('typed-array-buffer');
  13. const assert = require('assert');
  14. const arr = new Uint8Array(0);
  15. assert.equal(arr.buffer, typedArrayBuffer(arr));
  16. ```
  17. ## Tests
  18. Simply clone the repo, `npm install`, and run `npm test`
  19. [package-url]: https://npmjs.org/package/typed-array-buffer
  20. [npm-version-svg]: https://versionbadg.es/inspect-js/typed-array-buffer.svg
  21. [deps-svg]: https://david-dm.org/inspect-js/typed-array-buffer.svg
  22. [deps-url]: https://david-dm.org/inspect-js/typed-array-buffer
  23. [dev-deps-svg]: https://david-dm.org/inspect-js/typed-array-buffer/dev-status.svg
  24. [dev-deps-url]: https://david-dm.org/inspect-js/typed-array-buffer#info=devDependencies
  25. [npm-badge-png]: https://nodei.co/npm/typed-array-buffer.png?downloads=true&stars=true
  26. [license-image]: https://img.shields.io/npm/l/typed-array-buffer.svg
  27. [license-url]: LICENSE
  28. [downloads-image]: https://img.shields.io/npm/dm/typed-array-buffer.svg
  29. [downloads-url]: https://npm-stat.com/charts.html?package=typed-array-buffer
  30. [codecov-image]: https://codecov.io/gh/inspect-js/typed-array-buffer/branch/main/graphs/badge.svg
  31. [codecov-url]: https://app.codecov.io/gh/inspect-js/typed-array-buffer/
  32. [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/typed-array-buffer
  33. [actions-url]: https://github.com/inspect-js/typed-array-buffer/actions