3.75 GB
76,734 files
Updated about 1 month ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| .github | 1 items | ||
| test | 2 items | ||
| .eslintignore | 10 Bytes xet | e8d1b70a | |
| .eslintrc | 208 Bytes xet | b834ba31 | |
| .nycrc | 139 Bytes xet | 4fec1c2b | |
| CHANGELOG.md | 10.3 kB xet | 50296e59 | |
| LICENSE | 1.07 kB xet | 8eb499f2 | |
| README.md | 1.98 kB xet | a98ce675 | |
| callBound.js | 413 Bytes xet | 5be0d6a6 | |
| index.js | 641 Bytes xet | 43df343c | |
| package.json | 2.3 kB xet | afb67436 |
call-bind
Robustly .call.bind() a function.
Getting started
npm install --save call-bind
Usage/Examples
const assert = require('assert');
const callBind = require('call-bind');
const callBound = require('call-bind/callBound');
function f(a, b) {
assert.equal(this, 1);
assert.equal(a, 2);
assert.equal(b, 3);
assert.equal(arguments.length, 2);
}
const fBound = callBind(f);
const slice = callBound('Array.prototype.slice');
delete Function.prototype.call;
delete Function.prototype.bind;
fBound(1, 2, 3);
assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);
Tests
Clone the repo, npm install, and run npm test
- Total size
- 3.75 GB
- Files
- 76,734
- Last updated
- Sep 11
- Pre-warmed CDN
- US EU US EU
