Skip to content

Instantly share code, notes, and snippets.

@briancavalier
Last active December 19, 2015 11:39
Show Gist options
  • Save briancavalier/5948810 to your computer and use it in GitHub Desktop.
Save briancavalier/5948810 to your computer and use it in GitHub Desktop.
var when = require('when');
var parallel = require('when/parallel');
parallel([getData, makeFolder])
.spread(writeFile)
.then(emailLink)
.then(console.log);
function getData() {
return when('the data');
}
function makeFolder() {
return when('the folder');
}
function writeFile(data, folder) {
return when(folder + '/' + data);
}
function emailLink(file) {
return when('http://link.to/the/file');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment