Skip to content

Instantly share code, notes, and snippets.

@asvny
Created July 7, 2016 13:46
Show Gist options
  • Save asvny/d76843119569c5ac799f991085eeaedd to your computer and use it in GitHub Desktop.
Save asvny/d76843119569c5ac799f991085eeaedd to your computer and use it in GitHub Desktop.
run
function run(makeGenerator) {
return function() {
var generator = makeGenerator.apply(this, arguments);
var handle = function(p) {
if (p.done) return p.value;
return p.value.then(function(v) {
return handle(generator.next(v));
});
};
return handle(generator.next());
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment