Skip to content

Large integers lose precision when parsed #29

@remorses

Description

@remorses

When parsing command-line arguments with large integer values (> Number.MAX_SAFE_INTEGER), precision is lost because the value is converted to JavaScript Number.

mri(['--id', '9007199254740993'])
// { id: 9007199254740992 }  // wrong! lost precision

This affects downstream packages like cac which uses mri for argument parsing.

Proposed fix: Use BigInt for integers that exceed the safe integer range. See #28

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