Last active
September 18, 2017 19:35
-
-
Save JPGygax68/5978179 to your computer and use it in GitHub Desktop.
How to create a dynamic #promise chain.
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
// var index = ... hash of id => filename | |
return _.reduce(index, function(seq, filename, id) { | |
return seq.then( function() { return fs.read(filename); } ) | |
}, Q.resolve()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment