Skip to content

Instantly share code, notes, and snippets.

@pstadler
Last active January 18, 2017 19:18
Show Gist options
  • Save pstadler/ecbecf9d7cfbd0642293 to your computer and use it in GitHub Desktop.
Save pstadler/ecbecf9d7cfbd0642293 to your computer and use it in GitHub Desktop.
ES2015 Promisify Pattern
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