Skip to content

Instantly share code, notes, and snippets.

@uadev
Created December 21, 2016 13:37
Show Gist options
  • Save uadev/b26aff7946d0976ba743b28254579343 to your computer and use it in GitHub Desktop.
Save uadev/b26aff7946d0976ba743b28254579343 to your computer and use it in GitHub Desktop.
function promisify(func, ...args) {
return (args) => {
return new Promise((resolve, reject) => {
func(args, (err, ...args) => {
if (err) {
return reject(err);
}
resolve(args);
})
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment