function getFirstResolvingPromise < T > ( promises ) { return Promise . all ( promises . map ( ( p ) => { return p . then ( ( val ) => Promise . reject ( val ) , ( err ) => Promise . resolve ( err ) ) ; } ) ) . then ( ( errors ) => Promise . reject ( errors ) , ( val ) => Promise . resolve ( val ) ) ; } export default getFirstResolvingPromise ;