Last active
January 4, 2016 07:59
-
-
Save mkuklis/8592005 to your computer and use it in GitHub Desktop.
simple run
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
function run(genfun) { | |
var gen = genfun(); | |
function next(err, answer) { | |
if (err) { | |
return gen.throw(err); | |
} | |
var res = gen.next(answer); | |
if (!res.done) { | |
res.value(next); | |
} | |
} | |
next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment