Created
December 2, 2016 02:40
-
-
Save jooyunghan/ca3eae1619ea6333fff153ecefeed6e9 to your computer and use it in GitHub Desktop.
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 GenIter(c, genf) { | |
this.c = c; | |
this.genf = genf; | |
} | |
GenIter.prototype.next = function next() { | |
var f = this.genf; | |
var result = f(this.c); | |
if (result === stop) { | |
return {done: true}; | |
} else { | |
return {done: false, value: result}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment