kriskowal/q — Issue #52: Add back in examples of array processing
Author: domenic
Created: 2012-03-08 21:05:36+00:00
State: open

I have an array of promisey functions, and I want to call them one after the other. What's a nice, concise way to do this?

The old README, under "Serial Join", had some nice exampes using `Array.prototype.reduce` and `Q.wait`. But `Q.wait` is dead, not that I knew what it really did in the first place.

So far the best I have is

```javascript
var array = [fooAsync, barAsync];

return array.reduce(function (soFar, thisFuncAsync) {
return soFar.then(thisFuncAsync);
}, Q.resolve());
```

But it feels weird having to pass in the empty `Q.resolve`.