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

Add option to disable numeric conversion for arguments #12

Open
micalevisk opened this issue Jan 22, 2022 · 3 comments
Open

Add option to disable numeric conversion for arguments #12

micalevisk opened this issue Jan 22, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@micalevisk
Copy link
Collaborator

Original issue by @whitlockjc at https://github.com/substack/minimist/issues/36

const argv = require('minimist-lite')(process.argv.slice(2))
console.dir(argv)

If I invoke my command using my-command 2.3, I end up with something like this:

{ _: [ 2.3 ] }

I realize if this was an option I could use opts.string to tell minimist to treat my option as a string but looks like there's no way to achieve the same for argument.

What I expect instead:

{ _: [ '2.3' ] }
@micalevisk micalevisk added the enhancement New feature or request label Jan 22, 2022
@micalevisk
Copy link
Collaborator Author

I do agree with this comment

Implicit coercing for the rest arguments is not a good default and should be off by default.

Thus we can add this new option using false by default, and then changing it to true in the next major relase.

@meszaros-lajos-gyorgy
Copy link
Owner

I would vote on keeping the original behavior just to not introduce a breaking change, but having an option to control that is definitely a good idea.

@micalevisk
Copy link
Collaborator Author

micalevisk commented Feb 19, 2022

I believe this will fix this other issue: https://github.com/substack/minimist/issues/112

$ node example/parse.js 002e1234
{ _: [ Infinity ] }

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

No branches or pull requests

2 participants