Last active
January 18, 2017 19:18
-
-
Save pstadler/ecbecf9d7cfbd0642293 to your computer and use it in GitHub Desktop.
ES2015 Promisify Pattern
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 fnPromisified = (arg) => new Promise((resolve, reject) => | |
fnTakingCallback(arg, (err, res) => { | |
if (err) { | |
return reject(err) | |
} | |
return resolve(res) | |
}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment