This is portable opensource javascript prime tester, and generator. You can test any number for primality and generate prime numbers faster, using miller-rabin ...
For native implementation, it translates to Node.js >= 4.0 and most modern browsers (excluding IE). Apply your favourite shims to use the module in older environments. austere-tester is a lightweight ...