1 | # es-shim-unscopables <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
---|
2 |
|
---|
3 | [![github actions][actions-image]][actions-url]
|
---|
4 | [![coverage][codecov-image]][codecov-url]
|
---|
5 | [![dependency status][deps-svg]][deps-url]
|
---|
6 | [![dev dependency status][dev-deps-svg]][dev-deps-url]
|
---|
7 | [![License][license-image]][license-url]
|
---|
8 | [![Downloads][downloads-image]][downloads-url]
|
---|
9 |
|
---|
10 | [![npm badge][npm-badge-png]][package-url]
|
---|
11 |
|
---|
12 | Helper package to shim a method into `Array.prototype[Symbol.unscopables]`
|
---|
13 |
|
---|
14 | ## Example
|
---|
15 |
|
---|
16 | ```js
|
---|
17 | const assert = require('assert');
|
---|
18 |
|
---|
19 | const shimUnscopables = require('es-shim-unscopables');
|
---|
20 |
|
---|
21 | let copyWithin;
|
---|
22 | let concat;
|
---|
23 | with ([]) {
|
---|
24 | assert.equal(concat, Array.prototype.concat);
|
---|
25 | assert.notEqual(copyWithin, Array.prototype.copyWithin);
|
---|
26 | }
|
---|
27 |
|
---|
28 | shimUnscopables('concat');
|
---|
29 |
|
---|
30 | with ([]) {
|
---|
31 | assert.notEqual(concat, Array.prototype.concat);
|
---|
32 | assert.notEqual(copyWithin, Array.prototype.copyWithin);
|
---|
33 | }
|
---|
34 | ```
|
---|
35 |
|
---|
36 | ## Tests
|
---|
37 | Simply clone the repo, `npm install`, and run `npm test`
|
---|
38 |
|
---|
39 | ## Security
|
---|
40 |
|
---|
41 | Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
|
---|
42 |
|
---|
43 | [package-url]: https://npmjs.org/package/es-shim-unscopables
|
---|
44 | [npm-version-svg]: https://versionbadg.es/ljharb/es-shim-unscopables.svg
|
---|
45 | [deps-svg]: https://david-dm.org/ljharb/es-shim-unscopables.svg
|
---|
46 | [deps-url]: https://david-dm.org/ljharb/es-shim-unscopables
|
---|
47 | [dev-deps-svg]: https://david-dm.org/ljharb/es-shim-unscopables/dev-status.svg
|
---|
48 | [dev-deps-url]: https://david-dm.org/ljharb/es-shim-unscopables#info=devDependencies
|
---|
49 | [npm-badge-png]: https://nodei.co/npm/es-shim-unscopables.png?downloads=true&stars=true
|
---|
50 | [license-image]: https://img.shields.io/npm/l/es-shim-unscopables.svg
|
---|
51 | [license-url]: LICENSE
|
---|
52 | [downloads-image]: https://img.shields.io/npm/dm/es-shim-unscopables.svg
|
---|
53 | [downloads-url]: https://npm-stat.com/charts.html?package=es-shim-unscopables
|
---|
54 | [codecov-image]: https://codecov.io/gh/ljharb/es-shim-unscopables/branch/main/graphs/badge.svg
|
---|
55 | [codecov-url]: https://app.codecov.io/gh/ljharb/es-shim-unscopables/
|
---|
56 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-shim-unscopables
|
---|
57 | [actions-url]: https://github.com/ljharb/es-shim-unscopables/actions
|
---|