0.1.3 • Published 9 years ago

bind-gen v0.1.3

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

node-bind-gen Build Status

A simple helper function to use bind with generator functions. It works like lodash bind function, or the built-in bind, but takes and returns a generator function instead of a normal one.

Installation

$ npm install bind-gen

Example

var co      = require('co');
var bindGen = require('bind-gen');

var myGenerator = function *(myArg, myOtherArg) {
  console.log(this.v);
  console.log(myArg);
  console.log(myOtherArg);
};

var context = {v: 'the-context'};
var boundGenerator = bindGen(myGenerator, context, 'arg');

co(boundGenerator('other arg'));
// will print:
// the-context
// arg
// other arg
0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago