Skip to content

Instantly share code, notes, and snippets.

@frenchie4111
Created July 15, 2015 09:03
Show Gist options
  • Save frenchie4111/189eeae5ddec9c14004b to your computer and use it in GitHub Desktop.
Save frenchie4111/189eeae5ddec9c14004b to your computer and use it in GitHub Desktop.
allResolved
export default function( promises ) {
var caught_promises = promises.map( function( promise ) {
return promise.catch( function() {} );
} );
return Promise.all( caught_promises );
};
import allResolved from './allResolved';
var a = new Promise( function( resolve, reject ) {
reject( new Error( 'a' ) );
} );
var b = new Promise( function( resolve, reject ) {
resolve( 'b' );
} );
allResolved( [ a, b ] )
.then( function( result ) {
console.log( 'result:', result );
} );
// [ undefined, 'b' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment