Skip to content

Instantly share code, notes, and snippets.

@grabbou
Created February 26, 2015 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grabbou/5632a8874378e59e99cb to your computer and use it in GitHub Desktop.
Save grabbou/5632a8874378e59e99cb to your computer and use it in GitHub Desktop.
var Promise = require('bluebird');
function doSomethingAsync(data, callback) {
return $blueBirdPromise
.tap(function() {
console.log('Op is successful');
})
.nodeify(callback);
};
allows to write:
doSomethingAsync(function(err, data) {
});
or doSomethingAsync.then(function(data) { }).catch(function(err) { });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment