Created
May 19, 2015 12:11
-
-
Save spelufo/8993bc18848b66b00143 to your computer and use it in GitHub Desktop.
node12 --harmony denodeify
This file contains hidden or 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
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