var resolver = (
(theArr) => (
new Promise(
(doRes, doRej) => (
theArr.reduce(
(theAcc, thePr) => (
thePr.then(
doRes
, (theReason) => (
(theAcc.push(theReason) === theArr.length) && doRej(theAcc)
)
)
, theAcc
)
, []
)
)
)
)
);
var theInput =
[ Promise.reject(1)
, Promise.reject(2)
, Promise.reject(3)
];
resolver(theInput)
.then(
(theRes) => console.log({ theRes })
, (theErr) => console.log({ theErr })
);