Skip to content

Instantly share code, notes, and snippets.

@tario
Last active November 5, 2015 18:26
Show Gist options
  • Save tario/7827b9dbdd27fac58fdf to your computer and use it in GitHub Desktop.
Save tario/7827b9dbdd27fac58fdf to your computer and use it in GitHub Desktop.
PromiseCode
return Q.Promise(function(resolve, reject) {
return request.post(options, function(err, response, body){
if (err){ reject(err) }
resolve(body);
});
});
return Q.nfcall(function(options, cb) {
return request.post(options, function(err, response, body) {
cb(err, body);
});
}, options);
var requestPost = Q.denodeify(function(options, cb) {
return request.post(function(err, response, body) {
cb(err, body);
});
});
return requestPost(options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment