13 lines
No EOL
343 B
TypeScript
13 lines
No EOL
343 B
TypeScript
export const formatCount = (count: number): string => {
|
|
if (count >= 1_000_000) {
|
|
return `${(count / 1_000_000).toFixed(1)}M`;
|
|
}
|
|
if (count >= 1_000) {
|
|
return `${(count / 1_000).toFixed(1)}k`;
|
|
}
|
|
return count.toLocaleString();
|
|
};
|
|
|
|
export const formatExactCount = (count: number): string => {
|
|
return count.toLocaleString();
|
|
}; |