Package Exports
- @putout/plugin-generators
- @putout/plugin-generators/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@putout/plugin-generators) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@putout/plugin-generators 
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.
Install
npm i @putout/plugin-generators -DRules
Config
{
"rules": {
"generators/add-missing-star": "on",
"generators/convert-multiple-to-generator": "on"
}
}add-missing-star
The
function*declaration creates a binding of a new generator function to a given name.(c) MDN
β Example of incorrect code
function hello() {
yield;
'world';
}
function func2() {
yield * func1();
}β Example of correct code
function* hello() {
yield 'world';
}
function* func2() {
yield* func1();
}convert-multiply-to-generator
Checkout in πPutout Editor.
β Example of incorrect code
const a = 5 * function hello() {};β Example of correct code
const a = 5;
function* hello() {}License
MIT