dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.64k stars 280 forks source link

Using binumbers or strings for input #231

Open toschdev opened 7 years ago

toschdev commented 7 years ago

Vorpal seems to be using numbers, even though I cannot find the exact code I am looking for, maybe you can help me.

screen shot 2017-05-11 at 13 53 00 1

The number I put in there seems to exceed JavaScript biggest numbers, therefore it just rounds the number starting from 9007199254740991.

It would be great to either have a bignumber library or using strings here. Maybe there is a workaround I did not think of yet?

LucasIsasmendi commented 7 years ago

The issue is with minimist: vorpal/dist/util.js here -> calls minimist arr = minimist(arr, opts);

minimist.js here flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)

Integer range for Number:

Solution: implement something like big-integer instead of Number() within minimist