se-panfilov / jsvat

Check the validity of the format of an EU VAT number
http://se-panfilov.github.io/jsvat
MIT License
131 stars 34 forks source link

Can't find variable: BigInt on Safari #94

Closed loiic-v closed 4 years ago

loiic-v commented 4 years ago

Screenshot 2020-04-09 at 11 44 27

https://caniuse.com/#feat=bigint Workaround: This library works as a polyfill. Or JSBI, which is a pure-JavaScript implementation of the official ECMAScript BigInt proposal (BTW, why not simple user Number?)

wilgert commented 4 years ago

@ruinyourfun Are you willing/able/available to create a PR? I'd be happy to review and merge it!

loiic-v commented 4 years ago

Well I could but to be honest I don't quite catch why the use of BigInt instead of Number (I doubt the tested value should ever be larger than 2^53)

Then the only change should be in ./src/lib/countries/netherlands.ts l.59 return Number(value) % Number(97) === Number(1);

MattivdWeem commented 4 years ago

That was my pr that implemented the BigInt; i created a new one where i implemented jsbi; we can't use Number, due to the way that the check value is created in the format, which will almost always run above 2^53. (you can reproduce that by changing the % test into Number and run the test suite)