mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
Fix percentage helper
This commit is contained in:
parent
0626daab0b
commit
747ff21218
@ -90,6 +90,7 @@ export function uuidPrefix(uuid: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function percentage(numerator: number, denominator: number): string {
|
export function percentage(numerator: number, denominator: number): string {
|
||||||
|
if (denominator === 0) return "0.00%";
|
||||||
const perc = ((numerator / denominator) * 100).toFixed(2);
|
const perc = ((numerator / denominator) * 100).toFixed(2);
|
||||||
return `${perc} %`;
|
return `${perc} %`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user