mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-04 13:29:13 -04:00
fix: display numbers always with dot
This commit is contained in:
parent
0de61ef555
commit
66dd351d48
3 changed files with 10 additions and 10 deletions
|
@ -6,9 +6,7 @@ export type AllSupportedUnits = BibytesUnits | BytesUnits | BitsUnits;
|
|||
export function displayStorageAndRateUnits(
|
||||
{ value, unit, precision = 3, appendUnit = false }:
|
||||
{ value: number; unit: AllSupportedUnits; precision?: number ; appendUnit?: boolean }): string {
|
||||
return value.toLocaleString(undefined, {
|
||||
maximumFractionDigits: precision,
|
||||
}) + (appendUnit ? unit : '');
|
||||
return value.toFixed(precision).replace(/0+$/, '').replace(/\.$/, '') + (appendUnit ? unit : ''); // NOSONAR
|
||||
}
|
||||
|
||||
export function convertStorageAndRateUnitsDisplay(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue