Created
June 25, 2017 01:53
-
-
Save venkatperi/1cddb221bc3033d394e7b3607fecd16a to your computer and use it in GitHub Desktop.
Execute array of promises in sequence
This file contains hidden or 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
pseq = ( arr ) => arr.reduce( | |
( r, n ) => r.then( typeof n === 'function' ? n : () => Promise.resolve( n ) ), | |
Promise.resolve() ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment