You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behaviour π€·ββοΈπ€·
Sending '123hello' or '192.168.1.1' should throw an exception
Additional context
The solution could be to check if the parsed value is stringify, it should be the same as the input value.
I've a PR ready if you're interested.
The text was updated successfully, but these errors were encountered:
My solution has one problem : if a number starts or ends with some 0 characters
00234 will be parsed has 234 but as string it will be 234 and not 00234
we should trim the string to remove unnecessary 0 characters (but keep one 0 if the number is 0 or 0.xxx)
I put aside this problem because I think that we do not really give a number with unnecessary 0
But the solution with 2 regex (one for integer /^[0-9]+$/ and one for float /^[0-9]+(\.[0-9]+)?$/) fixes this problem
Describe the bug π
The number accessors are too permissive.
The
parseInt
andparseFloat
functions allow strings beginning with numbers.To Reproduce π
Expected behaviour π€·ββοΈπ€·
Sending '123hello' or '192.168.1.1' should throw an exception
Additional context
The solution could be to check if the parsed value is stringify, it should be the same as the input value.
I've a PR ready if you're interested.
The text was updated successfully, but these errors were encountered: