Delegating yield
The yield* operator delegates to another generator. This provides a convenient mechanism for composing generators.
The expression yield* <
> is equivalent to: let (g = <>) { let received = void 0, send = true, result = void 0; try { while (true) { let next = send ? g.send(received) : g.throw(received); try { received = yield next; send = true; } catch (e) { received = e; send = false; } } } catch (e) { if (!isStopIteration(e)) throw e; result = e.value; } finally { try { g.close(); } catch (ignored) { } } result } This is similar to a for-in loop over the generator, except that it propagates exceptions thrown via the outer generator’s throw method into the delegated generator.
http://wiki.ecmascript.org/doku.php?id=harmony:generators
Delegating to another generator means the current generator stops producing values by itself, instead yielding the values produced by another generator until it exhausts it. It then resumes producing its own values, if any.
For instance, if secondGenerator() produces numbers from 10 to 15, and firstGenerator() produces numbers from 1 to 5 but delegates to secondGenerator() after producing 2, then the values produced by firstGenerator() will be:
1, 2, 10, 11, 12, 13, 14, 15, 3, 4, 5
http://stackoverflow.com/questions/17491779/delegated-yield-in-generator-functions