The Miracle of Generators
summary
Explains how ES2015 generator functions and the iterator protocol produce lazy infinite streams (example: an infinity generator) and how yield is bidirectional so a generator can receive values back. Builds a small run(iterator) driver that awaits Promises and returns a Promise of the final result, demonstrates fetching a text file with fetch(). Shows a generalized fetch-as-generator helper, composes take/map over infinite iterables, and integrates a Maybe-like wrapper to avoid undefined — the demos run successfully.
AI-written summary · about
chapters (4)
related talks
15mI Yield for Generators
31mPromises and Generators: control flow utopia
35mJavascript Generators
50mGenerators: A Hummer in the Stable?
28mWhat happens next: a choose-your-own-adventure with iterators
35mUntangle your code with yield
24mGenerating async iterators is ekstreamly easy, I Promise ;)
27mA, B, C. 1, 2, 3. Iterables you and me
