@putout/plugin-apply-early-return
🐊Putout plugin adds ability use apply early return
Last updated a year ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-apply-early-return 
SYNC missed versions from official npm registry.

@putout/plugin-apply-early-return NPM version

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.

(c) dev.to

🐊Putout plugin adds ability to apply early return.

Install

npm i @putout/plugin-apply-early-return

Rule

{
    "rules": {
        "apply-early-return": "on"
    }
}

❌ Example of incorrect code

function get(a) {
    let b = 0;
    
    if (a > 0)
        b = 5;
    else
        b = 7;
    
    return b;
}

✅ Example of correct code

function get(a) {
    if (a > 0)
        return 5;
    
    return 7;
}

License

MIT

Current Tags

  • 3.0.0                                ...           latest (a year ago)

4 Versions

  • 3.0.0                                ...           a year ago
  • 2.0.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (8)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE