@putout/plugin-convert-index-of-to-includes

2.0.1 • Public • Published

@putout/plugin-convert-index-of-to-includes NPM version

The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.

(c)MDN

🐊Putout plugin adds ability to convert indexOf to includes.

Install

npm i @putout/plugin-convert-index-of-to-includes -D

Rule

{
    "rules": {
        "convert-index-of-to-includes": "on"
    }
}

Example of incorrect code

if (~array.indexOf(element)) {
}

Example of correct code

if (array.includes(element)) {
}

License

MIT

Package Sidebar

Install

npm i @putout/plugin-convert-index-of-to-includes

Weekly Downloads

13,766

Version

2.0.1

License

MIT

Unpacked Size

3.74 kB

Total Files

4

Last publish

Collaborators

  • coderaiser