format-decimal
Format thousands and decimals with custom separator: 1.000.000,00
Options
You can pass a configuration object as second parameter with the following keys:
- decimal: Symbol to use for decimal point (default:
,
). - precision: Number of decimal digits to show (default:
2
). - thousands: Symbol to use for thousands separator (default:
.
).
Usage
const formatDecimal = ; console; // 123.456,79console; // 123,456.8