Skip to content

Instantly share code, notes, and snippets.

@JPGygax68
Last active September 18, 2017 19:35
Show Gist options
  • Save JPGygax68/5978179 to your computer and use it in GitHub Desktop.
Save JPGygax68/5978179 to your computer and use it in GitHub Desktop.
How to create a dynamic #promise chain.
// 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