Interface: BigNumberFormatter
Numeral.js-compatible formatter for Big.js numbers Supports common numeral.js format patterns for arbitrarily large numbers
Format patterns supported:
0,0- Number with thousands separators0,0.00- Number with thousands separators and 2 decimal places0.00- Number with 2 decimal places (no thousands separator)0,0.0000- Number with thousands separators and 4 decimal places$0,0.00- Currency format with dollar sign0,0.00$- Currency format with dollar sign at end0.00%- Percentage (multiplies by 100)0.00‰- Per mille (multiplies by 1000)(0,0.00)- Parentheses for negative numbers0,0.00a- Abbreviated format (K, M, B, T)0,0.00b- Bytes format (B, KB, MB, GB, TB, PB)0,0o- Ordinal format (1st, 2nd, 3rd, 4th)+0,0.00- Force sign display0,0.00[0000]- Optional decimal places
Methods
format()
ts
format(value: string | number | bigint | Big, format: string): string;Main format method that parses numeral.js format strings
Parameters
| Parameter | Type |
|---|---|
value | string | number | bigint | Big |
format | string |
Returns
string