This repo contains some demonstration code samples on how to use ES6 generators.
Read more at https://advancedweb.hu/2016/05/31/infinite-collections-with-es6-generators/ .
Hand-creating iterators requires boilerplate, but it is the basis for generators. You can create infinite collections easily.
http://sashee.github.io/infinite-collections-with-es6-generators/iterator.html
Generators are syntax sugar on top of iterators, but they make them a whole lot simpler and readable.
http://sashee.github.io/infinite-collections-with-es6-generators/generators.html
Infinite collections come handy when you don't know how many elements you'll need in advance. This sample demonstrates this problem.
When you want to sum the first 100 positive numbers, you know you'll need 100 elements. But what if you want to sum the first 100 primes?
http://sashee.github.io/infinite-collections-with-es6-generators/primes.html
You can create infinite collections using generators. With the help of the Gentoo library (among others) you can write terse and readable functions.
http://sashee.github.io/infinite-collections-with-es6-generators/gentoo.html