The generator.next() method

Domenic Denicola domenic at domenicdenicola.com
Fri Aug 23 06:39:40 PDT 2013


I believe .value is indeed correct, although as André alludes to, .send() has been replaced by .next().

[Working example in Traceur][1] (this is fun!)

[1]: http://traceur-compiler.googlecode.com/git/demo/repl.html#function*%20gen%28%29%20{%0A%20%20var%20{x%2C%20y%2C%20z}%20%3D%20yield%20[1%2C%202%2C%203]%0A%20%20return%20x%20%26%26%20y%20||%20z%0A}%0Avar%20g%20%3D%20gen%28%29%0Avar%20[a%2C%20b%2C%20c]%20%3D%20g.next%28%29.value%0Aconsole.log%28%27a%20%3D%3D%3D%201%27%2C%20a%20%3D%3D%3D%201%29%0Aconsole.log%28%27b%20%3D%3D%3D%202%27%2C%20b%20%3D%3D%3D%202%29%0Aconsole.log%28%27c%20%3D%3D%3D%203%27%2C%20c%20%3D%3D%3D%203%29%0Avar%20res%20%3D%20g.next%28{x%3A%20true%2C%20y%3A%20false%2C%20z%3A%20true}%29.value%0Aconsole.log%28%27res%20%3D%3D%3D%20true%27%2C%20res%20%3D%3D%3D%20true%29


More information about the es-discuss mailing list