### Q(object).eachSeries(iterator)
Q([1, 2, 3, 4]).eachSeries(function(num, i) {
if (num * 3 < 10) storage.push(num);
});
Q([{ name: 'Mark' }, { name: 'Sarah' }])
.eachSeries(function(person, i) {
return People.new(person.name);
});
Q({ one: 1, two: 2, three: 3 }).eachSeries(function(num, key) {
console.log(key, num);
});
### Q.times(n, iterator)
### Q(value).times(n, iterator)
Calls the iterator
n times, and accumulates results the same way you'd use map.
var getPage = function(page) {
return Results.limit(10).offset(page * 10);
};
Q.times(10, getPage).then(function(pages) {
console.log(pages[0]);
});
Q(true).times(3, function(isCool) {
if (isCool) return "cool";
return "not cool";
}).then(function(arr) {
console.log(arr);
});