Skip to content

Instantly share code, notes, and snippets.

@jooyunghan
Created December 2, 2016 02:38
Show Gist options
  • Save jooyunghan/cca5994cd63a6fa9379d0b5addfcc3df to your computer and use it in GitHub Desktop.
Save jooyunghan/cca5994cd63a6fa9379d0b5addfcc3df to your computer and use it in GitHub Desktop.
function Context() {
this.next = 0;
}
var stop = {};
Context.prototype.stop = function stop() {
return stop;
}
function GenFun(c, genf) {
this.c = c;
this.genf = genf;
}
GenFun.prototype[Symbol.iterator] = function iterator() {
return new GenIter(this.c, this.genf);
}
function wrap(genf) {
var c = new Context();
return new GenFun(c, genf);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment