Created
June 24, 2015 02:49
-
-
Save alivesay/2ec337ef688f45c74ee6 to your computer and use it in GitHub Desktop.
promiseToCallback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function promiseToCallback(promise, callback) { | |
promise | |
.then(function (result) { | |
return callback(null, result); | |
}) | |
.catch(function (err) { | |
return callback(err, null); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment