[79a0317] | 1 | # call-bound <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 | Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.
|
---|
| 13 |
|
---|
| 14 | ## Getting started
|
---|
| 15 |
|
---|
| 16 | ```sh
|
---|
| 17 | npm install --save call-bound
|
---|
| 18 | ```
|
---|
| 19 |
|
---|
| 20 | ## Usage/Examples
|
---|
| 21 |
|
---|
| 22 | ```js
|
---|
| 23 | const assert = require('assert');
|
---|
| 24 | const callBound = require('call-bound');
|
---|
| 25 |
|
---|
| 26 | const slice = callBound('Array.prototype.slice');
|
---|
| 27 |
|
---|
| 28 | delete Function.prototype.call;
|
---|
| 29 | delete Function.prototype.bind;
|
---|
| 30 | delete Array.prototype.slice;
|
---|
| 31 |
|
---|
| 32 | assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);
|
---|
| 33 | ```
|
---|
| 34 |
|
---|
| 35 | ## Tests
|
---|
| 36 |
|
---|
| 37 | Clone the repo, `npm install`, and run `npm test`
|
---|
| 38 |
|
---|
| 39 | [package-url]: https://npmjs.org/package/call-bound
|
---|
| 40 | [npm-version-svg]: https://versionbadg.es/ljharb/call-bound.svg
|
---|
| 41 | [deps-svg]: https://david-dm.org/ljharb/call-bound.svg
|
---|
| 42 | [deps-url]: https://david-dm.org/ljharb/call-bound
|
---|
| 43 | [dev-deps-svg]: https://david-dm.org/ljharb/call-bound/dev-status.svg
|
---|
| 44 | [dev-deps-url]: https://david-dm.org/ljharb/call-bound#info=devDependencies
|
---|
| 45 | [npm-badge-png]: https://nodei.co/npm/call-bound.png?downloads=true&stars=true
|
---|
| 46 | [license-image]: https://img.shields.io/npm/l/call-bound.svg
|
---|
| 47 | [license-url]: LICENSE
|
---|
| 48 | [downloads-image]: https://img.shields.io/npm/dm/call-bound.svg
|
---|
| 49 | [downloads-url]: https://npm-stat.com/charts.html?package=call-bound
|
---|
| 50 | [codecov-image]: https://codecov.io/gh/ljharb/call-bound/branch/main/graphs/badge.svg
|
---|
| 51 | [codecov-url]: https://app.codecov.io/gh/ljharb/call-bound/
|
---|
| 52 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bound
|
---|
| 53 | [actions-url]: https://github.com/ljharb/call-bound/actions
|
---|