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

yargs converts numbers that start with 0x to decimals, even if parse-numbers if false #413

Closed
ghost opened this issue Sep 24, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 24, 2021

I'd rather have it pass me the hex representation. Or maybe there is another option that does that?

@xiongemi
Copy link

i just tried, but change the 'parse-numbers' to false, it actually keeps the hex code and not convert it to numbers. i think it is fixed?

@shadowspawn
Copy link
Member

Thanks @xiongemi

Confirmed working with this code:

const argv = require('yargs-parser')(process.argv.slice(2), { configuration: { 'parse-numbers': false }});
console.log(argv)
% node index.js --number 0xABCD 0xabcd
{ _: [ '0xabcd' ], number: '0xABCD' }

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

2 participants