@putout/plugin-convert-index-of-to-includes
v2.0.1
Published
šPutout plugin adds ability to convert indexOf to includes
Downloads
64,302
Maintainers
Readme
@putout/plugin-convert-index-of-to-includes
The
includes()
method determines whether an array includes a certain value among its entries, returningtrue
orfalse
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