You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
export const abbreviateNumber = (value: number): string => {
|
|
const suffixes = ["", "K", "M", "B", "T"];
|
|
|
|
let suffixNum = 0;
|
|
|
|
while (value >= 1000) {
|
|
value /= 1000;
|
|
suffixNum++;
|
|
}
|
|
|
|
value = parseInt(value.toPrecision(3));
|
|
|
|
return `${value}${suffixes[suffixNum]}`;
|
|
};
|