Created
February 12, 2015 23:49
-
-
Save shawnbot/02d14fd2034998b4aa31 to your computer and use it in GitHub Desktop.
asyncdammit
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
function noreallygimmeasyncdammit(sync) { | |
return function() { | |
var args = [].slice.call(arguments), | |
next = args.pop(); | |
try { | |
var value = sync.apply(this, args); | |
} catch (err) { | |
return next(err); | |
} | |
next(null, value); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment