# call-bind

> Robustly `.call.bind()` a function

Latest version **1.0.9** (published 2026-04-09) · MIT license · 0 weekly downloads

> **Better alternative:** Use Function.call.bind(v) — Consider using a lighter alternative

## Install

```sh
npm install call-bind
pnpm add call-bind
yarn add call-bind
bun add call-bind
```

## Health

**Score 58/100 (C)** — status: active.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2026-04-09 |
| First published | 2020-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/call-bind) |
| Module format | ESM + CommonJS |
| Node | >= 0.4 |
| Dependencies | 4 |
| Unpacked size | 23.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | javascript, ecmascript, es, js, callbind, callbound, call, bind, bound, call-bind, call-bound, function, es-abstract |

## Links

- npm: https://www.npmjs.com/package/call-bind
- Repository: https://github.com/ljharb/call-bind
- Homepage: https://github.com/ljharb/call-bind#readme
- Issues: https://github.com/ljharb/call-bind/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/call-bind

## Dependencies (4)

- [get-intrinsic](https://npm.io/package/get-intrinsic.md) ^1.3.0
- [es-define-property](https://npm.io/package/es-define-property.md) ^1.0.1
- [set-function-length](https://npm.io/package/set-function-length.md) ^1.2.2
- [call-bind-apply-helpers](https://npm.io/package/call-bind-apply-helpers.md) ^1.0.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.9 (latest) — 2026-04-09
- 1.0.8 — 2024-12-06
- 1.0.7 — 2024-02-13
- 1.0.6 — 2024-02-06
- 1.0.5 — 2023-10-20
- 1.0.4 — 2023-10-19
- 1.0.3 — 2023-10-19
- 1.0.2 — 2021-01-11
- 1.0.1 — 2021-01-09
- 1.0.0 — 2020-10-30

## README

# call-bind <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

Robustly `.call.bind()` a function.

## Getting started

```sh
npm install --save call-bind
```

## Usage/Examples

```js
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`

[package-url]: https://npmjs.org/package/call-bind
[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg
[deps-svg]: https://david-dm.org/ljharb/call-bind.svg
[deps-url]: https://david-dm.org/ljharb/call-bind
[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/call-bind.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg
[downloads-url]: https://npm-stat.com/charts.html?package=call-bind
[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/
[actions-image]: https://img.shields.io/github/check-runs/ljharb/call-bind/main
[actions-url]: https://github.com/ljharb/call-bind/actions

---
_Source: https://npm.io/package/call-bind · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
