This repository has been archived on 2024-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
p61-project/utils/maths.ts

10 lines
177 B
TypeScript
Raw Permalink Normal View History

2024-05-22 13:44:54 +02:00
export const calculateRatio = (value: number, total: number): number => {
if (total <= 0) {
return 0
}
if (value >= total) {
return 1
}
return value / total
}