Skip to content

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 separators
  • 0,0.00 - Number with thousands separators and 2 decimal places
  • 0.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 sign
  • 0,0.00$ - Currency format with dollar sign at end
  • 0.00% - Percentage (multiplies by 100)
  • 0.00‰ - Per mille (multiplies by 1000)
  • (0,0.00) - Parentheses for negative numbers
  • 0,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 display
  • 0,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

ParameterType
valuestring | number | bigint | Big
formatstring

Returns

string