Skip to content

@swapped/connect-sdk / format / getCompactNumberFormat

Function: getCompactNumberFormat() ​

getCompactNumberFormat(number): string

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

Picks a compact 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 compact pattern string ('0.0a' or '0a')