source: imaps-frontend/node_modules/arraybuffer.prototype.slice/README.md

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 2.5 KB
Line 
1# ArrayBuffer.prototype.slice <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
3[![github actions][actions-image]][actions-url]
4[![coverage][codecov-image]][codecov-url]
5[![License][license-image]][license-url]
6[![Downloads][downloads-image]][downloads-url]
7
8[![npm badge][npm-badge-png]][package-url]
9
10An ES spec-compliant `ArrayBuffer.prototype.slice` shim. Invoke its "shim" method to shim ArrayBuffer.prototype.slice if it is unavailable.
11
12This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice).
13
14Most common usage:
15```js
16var assert = require('assert');
17var slice = require('arraybuffer.prototype.slice');
18
19var ab = new ArrayBuffer(1);
20var arr = new Uint8Array(ab);
21arr[0] = 123;
22
23var ab2 = slice(ab);
24
25var arr2 = new Uint8Array(ab2);
26arr2[0] = 234;
27
28assert.deepEqual(arr, new Uint8Array([123]));
29assert.deepEqual(arr2, new Uint8Array([234]));
30
31if (!ArrayBuffer.prototype.transfer) {
32 slice.shim();
33}
34
35var ab2 = ab.slice();
36
37var arr2 = new Uint8Array(ab2);
38arr2[0] = 234;
39
40assert.deepEqual(arr, new Uint8Array([123]));
41assert.deepEqual(arr2, new Uint8Array([234]));
42```
43
44## Tests
45Simply clone the repo, `npm install`, and run `npm test`
46
47[package-url]: https://npmjs.org/package/arraybuffer.prototype.slice
48[npm-version-svg]: https://versionbadg.es/es-shims/ArrayBuffer.prototype.slice.svg
49[deps-svg]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice.svg
50[deps-url]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice
51[dev-deps-svg]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice/dev-status.svg
52[dev-deps-url]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice#info=devDependencies
53[npm-badge-png]: https://nodei.co/npm/arraybuffer.prototype.slice.png?downloads=true&stars=true
54[license-image]: https://img.shields.io/npm/l/arraybuffer.prototype.slice.svg
55[license-url]: LICENSE
56[downloads-image]: https://img.shields.io/npm/dm/arraybuffer.prototype.slice.svg
57[downloads-url]: https://npm-stat.com/charts.html?package=arraybuffer.prototype.slice
58[codecov-image]: https://codecov.io/gh/es-shims/ArrayBuffer.prototype.slice/branch/main/graphs/badge.svg
59[codecov-url]: https://app.codecov.io/gh/es-shims/ArrayBuffer.prototype.slice/
60[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/ArrayBuffer.prototype.slice
61[actions-url]: https://github.com/es-shims/ArrayBuffer.prototype.slice/actions
Note: See TracBrowser for help on using the repository browser.