Skip to content
This repository was archived by the owner on Mar 8, 2019. It is now read-only.

ianstormtaylor/bind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bind

A clear API for function binding helpers.

Installation

$ component install ianstormtaylor/bind
$ npm install ianstormtaylor/bind

Example

var bind = require('bind');

var object = {
  one: function(){},
  two: function(){}
};

// bind a single method
object.one = bind(object, object.one);

// bind certain methods
bind.methods(object, 'one', 'two');

// bind all methods
bind.all(object);

API

bind(object, function)

Bind a function to always be called with the object as context.

bind.all(object)

Bind all methods on an object to always be called with the object as context.

bind.methods(object, methods...)

Bind certain methods on object to always be called with the object as context.

License

MIT

About

A clear API for function binding helpers.

Resources

Stars

Watchers

Forks

Packages

No packages published