co-rega-foreach
Run generator function as Array.prototype.forEach callback.
Usage
Basic
'use strict';
var co = require('co');
var co_foreach = require('co-rega-foreach');
[1, 2, 3].forEach(function(num) {
console.log('Number is %d.', num);
});
co(function*() {
var request = require('co-request');
yield [1, 2, 3].forEach(function*(num) {
console.log('Number is %d.', num);
var res = yield request.get('http://example.com/#' + num);
console.log('StatusCode : %d', res.statusCode);
});
process.exit();
});
Switch between original and co-rega-foreach
'use strict';
var co = require('co');
var co_foreach = require('co-rega-foreach');
co_foreach.disabled();
co_foreach.enabled();
LICENSE
The MIT License (MIT)