2.0.1 β’ Published 3 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, returningtrueorfalseas appropriate.(c)MDN
πPutout plugin adds ability to convert indexOf to includes.
Install
npm i @putout/plugin-convert-index-of-to-includes -DRule
{
"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