Skip to content
/ bind-to Public
forked from bendrucker/bind-to

Bind all methods in an object to a specified context and arguments

License

Notifications You must be signed in to change notification settings

raine/bind-to

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bind-to Build Status

Bind all methods in an object to a specified context and arguments

Install

$ npm install --save bind-object

Usage

var bind = require('bind-to')
var object = {
  foo: function () {
    return this.bar
  }
}
var context = {
  bar: 'baz'
}
bind(object, context)
object.foo() // => 'baz'

API

bind(object, context, args...) -> object

Returns the original object for convenience.

object

Required
Type: object

The object to bind.

context

Required
Type: any

The this value to bind to.

args...

Variadic arguments to apply to the methods.

License

MIT © Ben Drucker

About

Bind all methods in an object to a specified context and arguments

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%