source: imaps-frontend/node_modules/call-bind/README.md@ d565449

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

Update repo after prototype presentation

  • Property mode set to 100644
File size: 2.0 KB
Line 
1# call-bind <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
12Robustly `.call.bind()` a function.
13
14## Getting started
15
16```sh
17npm install --save call-bind
18```
19
20## Usage/Examples
21
22```js
23const assert = require('assert');
24const callBind = require('call-bind');
25const callBound = require('call-bind/callBound');
26
27function f(a, b) {
28 assert.equal(this, 1);
29 assert.equal(a, 2);
30 assert.equal(b, 3);
31 assert.equal(arguments.length, 2);
32}
33
34const fBound = callBind(f);
35
36const slice = callBound('Array.prototype.slice');
37
38delete Function.prototype.call;
39delete Function.prototype.bind;
40
41fBound(1, 2, 3);
42
43assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);
44```
45
46## Tests
47
48Clone the repo, `npm install`, and run `npm test`
49
50[package-url]: https://npmjs.org/package/call-bind
51[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg
52[deps-svg]: https://david-dm.org/ljharb/call-bind.svg
53[deps-url]: https://david-dm.org/ljharb/call-bind
54[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg
55[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies
56[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true
57[license-image]: https://img.shields.io/npm/l/call-bind.svg
58[license-url]: LICENSE
59[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg
60[downloads-url]: https://npm-stat.com/charts.html?package=call-bind
61[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg
62[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/
63[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind
64[actions-url]: https://github.com/ljharb/call-bind/actions
Note: See TracBrowser for help on using the repository browser.