Last active
February 19, 2016 00:56
-
-
Save etale/b78fae2a327a6c93dd7d to your computer and use it in GitHub Desktop.
Oneliner Promisify
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
var promisify = (a) => (...b) => new Promise((c, d) => a(...b, (e, f) => e ? d(e) : c(f))) |
Author
etale
commented
Feb 17, 2016
// Spread operator only
var promisify = (a) => function () {
return new Promise((c, d) =>
a(...arguments, (e, f) => e ? d(e) : c(f)))
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment