jonschlinkert / is-number

JavaScript/Node.js utility. Returns `true` if the value is a number or string number. Useful for checking regex match results, user input, parsed strings, etc.
https://github.com/jonschlinkert
MIT License
259 stars 50 forks source link

Why does this even exist #39

Open Odex64 opened 1 month ago

Odex64 commented 1 month ago

Genuine question

wielorzeczownik commented 1 month ago

The is-number library is useful because of JavaScript's type coercion system, where different data types, like strings or objects, can sometimes be interpreted as numbers. JavaScript's implicit type conversion can result in unexpected outcomes, especially when checking if a value is numeric.