Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String types which contain a number prefixed by zero are incorrectly detected #476

Open
mryellow opened this issue Apr 19, 2023 · 0 comments

Comments

@mryellow
Copy link

I'm looking at an old version but seems current code has the same issue.

parseFloat('01111') === 1111

"01111" is not a number, but is instead a string.

function numberType(item) {
var rtn = parseFloat(item);
if (isNaN(rtn)) {
return item;
}
return rtn;
}

Unfortunately isFinite('01111') === true also otherwise it may be a solution.

You may need a Regex based approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant