Skip to content

Instantly share code, notes, and snippets.

@spelufo
Created May 19, 2015 12:11
Show Gist options
  • Save spelufo/8993bc18848b66b00143 to your computer and use it in GitHub Desktop.
Save spelufo/8993bc18848b66b00143 to your computer and use it in GitHub Desktop.
node12 --harmony denodeify
var denodeify = function (fn) {
return function () {
var that = this;
var args = [].slice.call(arguments);
return new Promise(function (resolve, reject) {
args.push((err, res) => err ? reject(err) : resolve(res));
fn.apply(that, args);
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment