šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@putout/plugin-apply-starts-with

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/plugin-apply-starts-with

🐊Putout plugin adds ability apply to '.starts.with()'

1.1.0
latest
Source
npm
Version published
Weekly downloads
3.6K
-9.49%
Maintainers
1
Weekly downloads
Ā 
Created
Source

@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

Keywords

putout

FAQs

Package last updated on 20 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts