Extracted pure functions to make tests happy

This commit is contained in:
Renan LE CARO 2025-03-29 21:22:19 +01:00
parent 8d7d97608d
commit a4e24fd397
5 changed files with 199 additions and 193 deletions

7
src/pure_functions.ts Normal file
View file

@ -0,0 +1,7 @@
export function clamp(value: number, min: number, max: number) {
return Math.max(min, Math.min(value, max));
}
export function comboKeepingRate(level: number) {
return clamp(1 - 1 / (1 + level) * 1.5, 0, 1)
}