Skip to content

Instantly share code, notes, and snippets.

@brunops
Created September 14, 2015 03:12
Show Gist options
  • Save brunops/7ebc44729971d0d1216f to your computer and use it in GitHub Desktop.
Save brunops/7ebc44729971d0d1216f to your computer and use it in GitHub Desktop.
transform order diff
var q = require('q');
function subtract2(data) {
return data - 2;
}
function multiply5(data) {
return data * 5;
}
q(2)
.then(subtract2)
.then(multiply5)
.then(console.log) // 0
.done();
q(2)
.then(multiply5)
.then(subtract2)
.then(console.log) // 8
.done();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment