On Thu, Jul 17, 2014 at 1:41 PM, Tab Atkins Jr. <[email protected]> wrote:
>
> Nope, that'll accept with `undefined` if the first settled promise is
> rejected. ^_^ This is non-trivial to do correctly; you need to have
Fixed:
```
Promise.any = function(promises) {
var errors = [];
return Promise.race(promises.map(function(p) {
return p.catch(function(e) { errors.push(e); if (errors.length >=
promises.length) throw errors; return Promise.race(); });
}));
};
```
--scott
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss