visionmedia/co — pull request #123 by zensh (2014-06-01 09:11:59+00:00)
Title: fix for 'Maximum call stack size exceeded' error

This case show a 'Maximum call stack size exceeded' error:

'use strict';
/*global console*/

// co version 3.0.6
var co = require('co'), list = [];

function task(callback) {
callback(null, 1);
};

// 10000 will throw a 'Maximum call stack size exceeded' error
for (var i = 0; i < 10000; i++) {
list[i] = i;
}

co(function *(){
for (var i = 0, l = list.length; i < l; i++) {
yield task;
}
})(function(){
console.log('Success!')
});