Hi everybody,

checking if a value is a number is currently really complicated and
I have stumbled upon a fair amount of code where this lead to bugs.

The easiest way is `typeof value === 'number'`.
This however has the drawback that `NaN` also evaluates to true.
Furthermore, basically every expression preceded by a `+` evaluates to true.
… and there are even more gotchas. For a full roundup read
https://github.com/jonschlinkert/is-number.

This implementation could also be used as a starting point.
(However, I would argue that `isNumber('3')` should evaluate to false.
It's a string after all.)

Therefore I think a `isNumber` functionality should already be provided
natively.
What do you think?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to