Skip to content

@swapped/connect-sdk / format / getCompactNumberFormat

Function: getCompactNumberFormat()

getCompactNumberFormat(number): string

Defined in: src/format/getCompactNumberFormat.ts:9

Picks a compact numeral pattern for abbreviated numbers. Uses one decimal place when the remainder after thousands is non-zero (e.g. 1.5k), otherwise a whole abbreviation (e.g. 1k).

Parameters

number

number

The number used to choose the pattern

Returns

string

A numeral format string ('0.0a' or '0a')