Bind all methods in an object to a specified context and arguments
$ npm install --save bind-object
var bind = require('bind-to')
var object = {
foo: function () {
return this.bar
}
}
var context = {
bar: 'baz'
}
bind(object, context)
object.foo() // => 'baz'
Returns the original object for convenience.
Required
Type: object
The object to bind.
Required
Type: any
The this
value to bind to.
Variadic arguments to apply to the methods.
MIT © Ben Drucker