vorpal icon indicating copy to clipboard operation
vorpal copied to clipboard

Using binumbers or strings for input

Open toschdev opened this issue 7 years ago • 1 comments

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?

toschdev avatar May 11 '17 11:05 toschdev

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:

  • var biggestInt = 9007199254740991;
  • var smallestInt = -9007199254740991;

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

LucasIsasmendi avatar May 29 '17 19:05 LucasIsasmendi