tc39 / proposal-number-fromstring

{BigInt,Number}.fromString(string, radix)
https://mathiasbynens.github.io/proposal-number-fromstring/
65 stars 7 forks source link

Consider not allowing leading whitespace #9

Closed domenic closed 6 years ago

domenic commented 6 years ago

The treatment of the beginning and end of the string is asymmetric; the beginning allows leading whitespace, while (#5) the end allows any trailing characters. This is weird.

I think the best thing to do, which also fits with the inverse-of-Number.prototype.toString idea, is to disallow both.

littledan commented 6 years ago

Symmetrical treatment sounds good. I'd be fine with allowing both as well (as the BigInt constructor does).

mathiasbynens commented 6 years ago

a29f339980abb55d93f50c650294eedf071363d5 includes this change. Please take a look and let me know of any issues.