🐊Putout plugin improves code related to generators
npm install @putout/plugin-generators[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-generators.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-generators"npm"
> 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
- ✅ add-missing-star;
- ✅ convert-multiple-to-generator;
`json`
{
"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
`js
function hello() {
yield;
'world';
}
function func2() {
yield * func1();
}
`
`js
function* hello() {
yield 'world';
}
function* func2() {
yield* func1();
}
`
Checkout in 🐊Putout Editor.
`js`
const a = 5 * function hello() {};
`js
const a = 5;
function* hello() {}
``
MIT