bind-object

1.1.0 • Public • Published

bind-object Build Status

Bind all methods in an object

Install

$ npm install --save bind-object

Usage

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

API

bindObject(object) -> object

Binds the functions in an object to the object itself and ignores other values. Returns the original object for convenience.

object

Required
Type: object

The object to bind.

License

MIT © Ben Drucker

Package Sidebar

Install

npm i bind-object

Weekly Downloads

1

Version

1.1.0

License

MIT

Last publish

Collaborators

  • bendrucker