Skip to content

Instantly share code, notes, and snippets.

@SeanChristopherConway
Last active May 19, 2016 20:50
Show Gist options
  • Save SeanChristopherConway/ebc0ae75dfef86cfbce97607a92734c1 to your computer and use it in GitHub Desktop.
Save SeanChristopherConway/ebc0ae75dfef86cfbce97607a92734c1 to your computer and use it in GitHub Desktop.
EmbeddedCallback
_ = require('underscore');
var fakeServerCall = function (obj) {
if (obj && obj.id) {
return {
state: true
};
}
};
var truthTest = function (data) {
console.log(JSON.stringify(data));
if (data.state) {
console.log("You have passed the truth test");
} else {
console.log("You have not passed the truth test");
}
};
var composedFunction = _.compose(truthTest,fakeServerCall);
composedFunction({
id: 1
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment