🐊Putout plugin adds ability to convert isNaN
to more robust Number.isNaN.
Not bundled because Number.isNaN
do not try to convert to Number
, and checks that isNaN
was a number
instead.
Number.isNaN('hello');
// returns
false;
isNaN('hello');
// returns
true;
npm i @putout/plugin-convert-is-nan-to-number-is-nan -D
{
"rules": {
"convert-is-nan-to-number-is-nan": "on"
}
}
if (isNaN(x))
return 'NaN';
if (Number.isNaN(x))
return 'Number NaN';
MIT