Magic behind ES6 generators