putout
plugin adds ability to convert isNaN
to more robust Number.isNaN.
Install
npm i @putout/plugin-convert-is-nan-to-number-is-nan -D
Rule
{
"rules": {
"convert-is-nan-to-number-is-nan": "on"
}
}
❌ Incorrect code example
if (isNaN(x)) {
return 'NaN';
}
✅ Correct code Example
if (Number.isNaN(x)) {
return 'Number NaN';
}
License
MIT