The number to format.
If true, adds a dollar sign prefix. If a string, uses it as the prefix.
Options for decimal places.
Optional
decimalPlaces: number = 0The number of decimal places to use when there is no suffix.
The formatted number.
numberFormatter_compact_lite(123456789, true); // "$123M"
numberFormatter_compact_lite(123456789, "€"); // "€123M"
numberFormatter_compact_lite(12345678); // "12.3M"
numberFormatter_compact_lite(123456789, false, { 3: 5 }); // "123.45678M"
numberFormatter_compact_lite(12345678, false, { 3: 5 }); // "12.3M"
numberFormatter_compact_lite(12345678, false, { 2: 3 }); // "12.345M"
Formats a number into a compact string representation.
This is a lightweight version of the numberFormatter_compact function, which does not use a Decimal instance.