I want to convert a string into a number in Node. It should reject (by throwing an error) any string that isn't a number, including strings like "0x1" and "NaN" and anything else that isn't (off the top of my head so forgive me) /\d+(\.\d+)?/. How do I do it?
-
-
Ha... I saw this tweet come in as I was searching for "can TypeScript exclude NaN from a number value's type?" The answer is "no", but there's an open issue for it!https://github.com/Microsoft/TypeScript/issues/28682 …
-
I still think it's amusing that the type of "not a number" is "number"
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.