Promise.allis rejected if one of the elements is rejected and Promise.all fails fast: If you have four promises which resolve after a timeout, and one rejects immediately, then Promise.all rejects immediately.
from Promise All - MDN
There are some cases which
Promise.all is not applicable for:
- Not all tasks are ensured to get executed due to
- You don't know the resolved values in detail, only the overall result
- You don't know rejected tasks which you may want to process afterwards.
Therefore, I made this
precise-promise-all, which will
- execute all the promise tasks
- return the precise resolved values and rejected promises as well.
$ npm install --save precise-promise-all
precise-promise-all provides two APIs which work in different way but yield the same result:
const PrecisePromiseAll = ;// iterable is an array of `() => somethingThatCreatesAPromise()`PrecisePromiseAll;