Created
April 5, 2020 14:38
-
-
Save Janoyan/3880f9e787e1ce15954ace5c0ef2523e to your computer and use it in GitHub Desktop.
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
const bluebird = require('bluebird'); | |
function echo(text, callback) { | |
callback(null, text); | |
} | |
const echoPromise = bluebird.promisify(echo); | |
echo('Hello', (err, result) => { | |
console.log(`From callback: ${result}`); | |
}); | |
echoPromise('Hello').then((result) => { | |
console.log(`From promise: ${result}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment