Skip to content

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

Description

@mryellow

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions