Skip to content

Instantly share code, notes, and snippets.

@marr
Created August 7, 2015 00:18
Show Gist options
  • Save marr/bb59fdb0f420e538df50 to your computer and use it in GitHub Desktop.
Save marr/bb59fdb0f420e538df50 to your computer and use it in GitHub Desktop.
const requestToPromise = function(requestObject) {
return new Promise(function(resolve, reject) {
requestObject
.end(function(err, res) {
if (err) {
reject(err);
}
else {
resolve(res.body);
}
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment