swc/crates/jsdoc/tests/fixtures/generators.js

29 lines
503 B
JavaScript
Raw Normal View History

2020-08-14 12:20:25 +03:00
'use strict';
/** Generate unique IDs starting at 0. */
function* startsAt0() {
var index = 0;
while (true) {
yield index++;
}
}
/** Generate unique IDs starting at 1. */
var startsAt1 = function* startsAt1() {
var index = 1;
while (true) {
yield index++;
}
};
/** Generator class. */
class Generator {
/** Generate unique IDs starting at 2. */
* startsAt2() {
var index = 2;
while (true) {
yield index++;
}
}
}