marcelo-ribeiro / smask

Smask - Vanilla JS Mask
https://marcelo-ribeiro.github.io/smask
11 stars 2 forks source link

Currency format fails when navigator is not available #6

Open eduardotorresdev opened 5 months ago

eduardotorresdev commented 5 months ago

Using smask in a sveltekit app generates a exception when page is rendered on server side because of lack of navigator variable on this environment.

I'd suggest to run a undefined check before using navigator. Therefore, it would be a good option to deliver a method to setLocale manually to the lib.

eduardotorresdev commented 5 months ago

I solved it setting the variable globally on hooks.server of sveltekit. It's not the best way, but it did worked.