@putout/plugin-apply-starts-with
🐊Putout plugin adds ability apply to '.starts.with()'
Last updated a year ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-apply-starts-with 
SYNC missed versions from official npm registry.

@putout/plugin-apply-starts-with NPM version

The startsWith() method determines whether a string begins with the characters of a specified string, returning true or false as appropriate.

(c) MDN

🐊Putout plugin adds ability to apply .startsWith().

Install

npm i @putout/plugin-apply-starts-with

Rule

{
    "rules": {
        "apply-starts-with": "on"
    }
}

❌ Example of incorrect code

function x(a = '') {
    if (!a.indexOf('1'))
        return false;
}

function x1({a = ''}) {
    return !a.indexOf('1');
}

function x2() {
    const {a = ''} = z;
    return !a.indexOf('1');
}

✅ Example of correct code

function x(a = '') {
    return a.startsWith('1');
}

function x1({a = ''}) {
    return a.startsWith('1');
}

function x2() {
    const {a = ''} = z;
    return a.startsWith('1');
}

License

MIT

Current Tags

  • 1.1.0                                ...           latest (a year ago)

2 Versions

  • 1.1.0                                ...           a year ago
  • 1.0.0                                ...           a year 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