Created
July 15, 2015 09:03
-
-
Save frenchie4111/189eeae5ddec9c14004b to your computer and use it in GitHub Desktop.
allResolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function( promises ) { | |
var caught_promises = promises.map( function( promise ) { | |
return promise.catch( function() {} ); | |
} ); | |
return Promise.all( caught_promises ); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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