se-panfilov / jsvat

Check the validity of the format of an EU VAT number

Home Page:http://se-panfilov.github.io/jsvat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't find variable: BigInt on Safari

loiic-v opened this issue · comments

commented

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?)

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

commented

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);

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)