Last active
September 18, 2017 06:56
-
-
Save barneycarroll/19ee83a1a538007950e1553f1bb3436f to your computer and use it in GitHub Desktop.
Fold left for generators
This file contains 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
export default iterator => | |
function * (cursor) { | |
while(cursor = iterator(cursor)) | |
cursor = yield(cursor) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment