@@ -8,6 +8,10 @@ const currency = (value = 0, symbol = '$', symbolPosition = 'before', thousandsS
decimalPlaces = 2
}
+ if (!!(`${thousandsSeparator}${decimalSeparator}`).replace(/\.,|,\./g, '')) {
+ throw new Error('Same thousands and decimal separator is not allowed')
+ }
+
value = value.split('.')
value[0] = value[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, `$1${thousandsSeparator}`)