Skip to content

Commit 35438a1

Browse files
committed
feat: updated format number helper (#719)
1 parent 945ee44 commit 35438a1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/viewModelBuilders/catalog/brc-analytics-catalog/common/viewModelBuilders.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,8 +1057,9 @@ function getPriorityPathogenEntityBreadcrumbs(
10571057
/**
10581058
* Format a number to a string.
10591059
* @param value - Number to format.
1060-
* @returns Formatted number.
1060+
* @returns Formatted number or empty string if invalid.
10611061
*/
1062-
export function formatNumber(value: number | null): string {
1063-
return value?.toLocaleString() || "";
1062+
export function formatNumber(value: unknown): string {
1063+
if (typeof value !== "number" || Number.isNaN(value)) return "";
1064+
return value.toLocaleString();
10641065
}

0 commit comments

Comments
 (0)