# deep-bind

> Bind a context to all functions in an object, including deeply nested functions.

Latest version **0.3.0** (published 2016-05-03) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2016-05-03 |
| First published | 2016-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Jon Schlinkert |
| Maintainers | doowb, jonschlinkert |
| Keywords | bind, context, deep, helper, helpers |

## Links

- npm: https://www.npmjs.com/package/deep-bind
- Repository: https://github.com/jonschlinkert/deep-bind
- Issues: https://github.com/jonschlinkert/deep-bind/issues
- npm.io page: https://npm.io/package/deep-bind

## Dependencies (1)

- [mixin-deep](https://npm.io/package/mixin-deep.md) ^1.1.3

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2016-05-03
- 0.2.2 — 2016-02-25
- 0.2.1 — 2016-01-31
- 0.2.0 — 2016-01-31
- 0.1.0 — 2016-01-21

## README

# deep-bind [![NPM version](https://img.shields.io/npm/v/deep-bind.svg?style=flat)](https://www.npmjs.com/package/deep-bind) [![NPM downloads](https://img.shields.io/npm/dm/deep-bind.svg?style=flat)](https://npmjs.org/package/deep-bind) [![Build Status](https://img.shields.io/travis/jonschlinkert/deep-bind.svg?style=flat)](https://travis-ci.org/jonschlinkert/deep-bind)

> Bind a context to all functions in an object, including deeply nested functions.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install deep-bind --save
```

## Usage

```js
var deepBind = require('deep-bind');
```

**Example**

Bind a context to an object of template helpers before passing them to an engine:

```js
var ctx = {
  app: {views: {}},
  context: {a: 'b'}
};

// pass the following to the template engine
var helpers = deepBind({
  foo: function() {
    return this.context;
  },
  bar: function() {},
  baz: function() {}
}, ctx);
```

## API

### [deepBind](index.js#L14)

Bind a `thisArg` to all the functions on the target

**Params**

* `target` **{Object|Array}**: Object or Array with functions as values that will be bound.
* `thisArg` **{Object}**: Object to bind to the functions
* `returns` **{Object|Array}**: Object or Array with bound functions.

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/deep-bind/issues/new).

## Building docs

Generate readme and API documentation with [verb](https://github.com/verbose/verb):

```sh
$ npm install verb && npm run docs
```

Or, if [verb](https://github.com/verbose/verb) is installed globally:

```sh
$ verb
```

## Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

## Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/deep-bind/blob/master/LICENSE).

***

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 02, 2016._

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