visionmedia/co — pull request #6 by Coreh (2013-06-09 06:39:40+00:00)
Title: Pass `next` as an argument to the generator

With this, `next` gets passed as an argument to the generator, so that you can use **co** with regular callbacks without wrapping them in any special way.

```javascript
var co = require('co');
var fs = require('fs');

co(function* (next) {
var foo = yield fs.readFile('foo.txt', next);
var bar = yield fs.readFile('bar.txt', next);
console.log(foo);
console.log(bar);
})
```

I added an arity check so that the `'yield a function or promise'` error is not thrown for generators taking `next`. Generators that don't take arguments retain the old behavior.