Created
May 29, 2018 17:17
-
-
Save Hydrock/eaf6a11c2b565aaa24c6a35c77db1ed2 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
| async = generator => { | |
| const generator = generatorCreator(); | |
| function next(value) { | |
| const nextResult = generator.next(value); | |
| if (nextResult.done) return nextResult.value; | |
| nextResult.value.then(next); | |
| }; | |
| next(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
async = generator =>should be replaced toasync = () =>or will be raised errorDuplicate declaration generator