kriskowal/q — pull request #307 by adjohnson916 (2013-05-31 22:39:24+00:00)
Title: Add `spreadResolved` function

This commit adds a function `spreadResolved` similar to `spread`, except that it doesn't short circuit to a `rejected` callback if/when one of the promises is rejected. Instead, it waits until all the promises are resolved, and then calls the single provided `resolved` callback with variadic arguments of either fulfilled values or rejection reasons.

I find this useful when I still want to collect the values of any promises that are fulfilled, even if some of the promises might be rejected. E.g.:

```js
Q.spreadResolved([
promiseThatFulfills,
promiseMaybeRejected, // might reject, with Error object as reason
promiseThatFulfills
], function (a, b, c) {
if (b instanceof Error) {
b = 'Some sensible default for b';
}
// go on using fulfilled values of `a` and `c`...
});
```