Home

Awesome

smart-bind npmjs.com The MIT License

Smarter binding of function with some context. It uses .apply instead of .bind, with reason.

code climate standard code style travis build status coverage status dependency status

Install

npm i smart-bind --save

Usage

For more use-cases see the tests

const smartBind = require('smart-bind')

smartBind

Smart bind ctx to fn instead use of native .bind

Params

Example

var smartBind = require('smart-bind')

function zoopark () { return this.foo }

var bound = smartBind({foo: 'bar'}, zoopark)

console.log(bound()) // => 'bar'
console.log(bound.toString()) // => 'function zoopark () { return this.foo }'

Related

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github