Socket
Socket
Sign inDemoInstall

@putout/plugin-apply-starts-with

Package Overview
Dependencies
389
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @putout/plugin-apply-starts-with

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


Version published
Weekly downloads
3.2K
increased by11.51%
Maintainers
1
Install size
4.90 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 20 Jul 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc