Promise.all, but it waits for all promises to settle even if one of them rejected.
npm install --save p-wait-all
var waitAll =var settled = falsevar result =result
Compare doing this with
var settled = falsevar result = PromiseallPromiseresult
This behaviour is useful if you are doing two async operations that may fail individually, so that both operations need to be rolled back.
For example, saving two related mongoose models, where one may fail (eg. from duplicate key errors):
You cannot remove a model if it is still in the process of being saved, so you have to wait for all the
save() promises to resolve before attempting to roll them back.
promises to settle. If any of them errored, reject the
result promise with the error. If all of them resolved, resolve
result with an array of resolution values, in order.