Add null check to formatCount function for default zero return
This commit is contained in:
@@ -109,6 +109,7 @@ export function getItemEmoji(itemName) {
|
|||||||
|
|
||||||
// Compact number formatting
|
// Compact number formatting
|
||||||
export function formatCount(count) {
|
export function formatCount(count) {
|
||||||
|
if (count == null) return '0';
|
||||||
if (count >= 1000000) return `${(count / 1000000).toFixed(1)}M`;
|
if (count >= 1000000) return `${(count / 1000000).toFixed(1)}M`;
|
||||||
if (count >= 1000) return `${(count / 1000).toFixed(1)}K`;
|
if (count >= 1000) return `${(count / 1000).toFixed(1)}K`;
|
||||||
return count.toString();
|
return count.toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user