https://github.com/es-shims/arraybuffer.prototype.detached
ES Proposal spec-compliant shim for ArrayBuffer.prototype.detached
https://github.com/es-shims/arraybuffer.prototype.detached
array arraybuffer buffer detached ecmascript es-shim es-shims javascript polyfill shim
Last synced: 3 months ago
JSON representation
ES Proposal spec-compliant shim for ArrayBuffer.prototype.detached
- Host: GitHub
- URL: https://github.com/es-shims/arraybuffer.prototype.detached
- Owner: es-shims
- License: mit
- Created: 2023-01-18T21:22:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-02T20:07:31.000Z (12 months ago)
- Last Synced: 2025-09-08T23:38:54.244Z (4 months ago)
- Topics: array, arraybuffer, buffer, detached, ecmascript, es-shim, es-shims, javascript, polyfill, shim
- Language: JavaScript
- Homepage: https://tc39.es/proposal-arraybuffer-transfer/#sec-get-arraybuffer.prototype.detached
- Size: 46.9 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
ArrayBuffer.prototype.detached [![Version Badge][npm-version-svg]][package-url]
[![Build Status][travis-svg]][travis-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
[![browser support][testling-svg]][testling-url]
An ES6 spec-compliant `ArrayBuffer.prototype.detached` shim. Invoke its "shim" method to shim ArrayBuffer.prototype.detached if it is unavailable.
*Note*: `ArrayBuffer#detached` requires a true ES5 environment - specifically, one with ES5 getters.
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the proposed [spec](https://tc39.es/proposal-arraybuffer-transfer/#sec-get-arraybuffer.prototype.detached).
Most common usage:
```js
var detached = require('arraybuffer.prototype.detached');
assert(detached(new ArrayBuffer('a') === false);
if (!ArrayBuffer.prototype.detached) {
detached.shim();
}
assert(new ArrayBuffer('a').detached, false);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.com/package/arraybuffer.prototype.detached
[npm-version-svg]: http://versionbadg.es/es-shims/ArrayBuffer.prototype.detached.svg
[travis-svg]: https://travis-ci.org/es-shims/ArrayBuffer.prototype.detached.svg
[travis-url]: https://travis-ci.org/es-shims/ArrayBuffer.prototype.detached
[deps-svg]: https://david-dm.org/es-shims/ArrayBuffer.prototype.detached.svg
[deps-url]: https://david-dm.org/es-shims/ArrayBuffer.prototype.detached
[dev-deps-svg]: https://david-dm.org/es-shims/ArrayBuffer.prototype.detached/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/ArrayBuffer.prototype.detached#info=devDependencies
[testling-svg]: https://ci.testling.com/es-shims/ArrayBuffer.prototype.detached.png
[testling-url]: https://ci.testling.com/es-shims/ArrayBuffer.prototype.detached
[npm-badge-png]: https://nodei.co/npm/arraybuffer.prototype.detached.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/arraybuffer.prototype.detached.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/arraybuffer.prototype.detached.svg
[downloads-url]: http://npm-stat.com/charts.html?package=arraybuffer.prototype.detached