The
function*
declaration creates a binding of a new generator function to a given name. A generator function can be exited and later re-entered, with its context (variable bindings) saved across re-entrances.(c) MDN
🐊Putout plugin improves Generator
-related code.
npm i @putout/plugin-generators -D
{
"rules": {
"generators/add-missing-star": "on",
"generators/convert-multiple-to-generator": "on"
}
}
The
function*
declaration creates a binding of a new generator function to a given name.(c) MDN
function hello() {
yield;
'world';
}
function func2() {
yield * func1();
}
function* hello() {
yield 'world';
}
function* func2() {
yield* func1();
}
Checkout in 🐊Putout Editor.
const a = 5 * function hello() {};
const a = 5;
function* hello() {}
MIT