Skip to content

FormatUnitsOptions

FormatUnitsOptions = object

Defined in: packages/synapse-core/src/utils/format.ts:32

optional compact?: boolean

Defined in: packages/synapse-core/src/utils/format.ts:45

Compact formatting (e.g. “1,000” becomes “1K”).


optional decimals?: number

Defined in: packages/synapse-core/src/utils/format.ts:37

The number of decimals. If not provided, the default is 18.


optional decimalsRounding?: "ROUND_HALF" | "ROUND_UP" | "ROUND_DOWN"

Defined in: packages/synapse-core/src/utils/format.ts:60

Method used to round to digits decimals (defaults to “ROUND_HALF”).


optional digits?: number

Defined in: packages/synapse-core/src/utils/format.ts:41

The number of digits to display after the decimal point.


optional locale?: Intl.LocalesArgument

Defined in: packages/synapse-core/src/utils/format.ts:55

The locale to use for formatting.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument


optional signDisplay?: "auto" | "always" | "exceptZero" | "negative" | "never"

Defined in: packages/synapse-core/src/utils/format.ts:66

How to display the sign of the number (defaults to “auto”).

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#signdisplay


optional trailingZeros?: boolean

Defined in: packages/synapse-core/src/utils/format.ts:49

Add trailing zeros if any, following the number of digits.