2.0.1 β’ Published 2 years ago
@putout/plugin-convert-index-of-to-includes v2.0.1
@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