Skip to content

Instantly share code, notes, and snippets.

View leojaimesson's full-sized avatar
🚀
Just Another Dev

leo jaimesson leojaimesson

🚀
Just Another Dev
View GitHub Profile
@leojaimesson
leojaimesson / currency.js
Created April 5, 2023 17:44
currency mask
const NUMBER_TO_DEFINE_DECIMAL_SEPARATOR_AND_CURRENCY = 1.1;
function getDecimalSeparatorByLocale(locale) {
return new Intl.NumberFormat(locale)
.format(NUMBER_TO_DEFINE_DECIMAL_SEPARATOR_AND_CURRENCY)
.replace(/\d/g, "");
}
function getThousandSeparatorByDecimalSeparator(decimalSeparator) {
if (decimalSeparator === ".") {