🐊Putout plugin adds ability use apply early return
npm install @putout/plugin-apply-early-return[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-early-return.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-early-return"npm"
> In short, an early return provides functionality so the result of a conditional statement can be returned as soon as a result is available, rather than wait until the rest of the function is run. Merged with @putout/plugin-return.
>
> (c) dev.to
🐊Putout plugin adds ability to apply early return.
```
npm i @putout/plugin-apply-early-return
`json`
{
"rules": {
"apply-early-return": "on"
}
}
`js`
function get(a) {
let b = 0;
if (a > 0)
b = 5;
else
b = 7;
return b;
}
`js``
function get(a) {
if (a > 0)
return 5;
return 7;
}
MIT