meszaros-lajos-gyorgy / minimist-lite

parse argument options
Other
15 stars 3 forks source link

Auto converting hex values to numbers #5

Closed meszaros-lajos-gyorgy closed 2 years ago

meszaros-lajos-gyorgy commented 2 years ago

Original issue by @dimabru at https://github.com/substack/minimist/issues/149

Hex parameters get auto-converted to numbers. This results in a loss of information and change of values since hex values often exceed max int.

example: input args --a 0xffffffffffffffffffff

code: console.log(process.argv.slice(2)); let args = minimist(process.argv.slice(2)); console.log(args['a']); console.log(args['a'].toString(16));

console output: image

100000000000000000000 is clearly !== 0xffffffffffffffffffff

micalevisk commented 2 years ago

I believe you can take the solution from this PR: https://github.com/substack/minimist/pull/150

meszaros-lajos-gyorgy commented 2 years ago

Added the fix and released a new version: https://github.com/meszaros-lajos-gyorgy/minimist-lite/releases/tag/v2.0.1