diff options
Diffstat (limited to 'src/modules/Util.js')
-rw-r--r-- | src/modules/Util.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/Util.js b/src/modules/Util.js index cbe466d..2375f10 100644 --- a/src/modules/Util.js +++ b/src/modules/Util.js @@ -10,4 +10,8 @@ function useAverage() { return [() => avg, append]; } -export { useAverage }; +function clamp(value, min, max) { + return Math.min(Math.max(value, min), max); +} + +export { useAverage, clamp }; |