summaryrefslogtreecommitdiff
path: root/util/numberWithinRange.ts
diff options
context:
space:
mode:
Diffstat (limited to 'util/numberWithinRange.ts')
-rw-r--r--util/numberWithinRange.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/numberWithinRange.ts b/util/numberWithinRange.ts
new file mode 100644
index 0000000..ae435ce
--- /dev/null
+++ b/util/numberWithinRange.ts
@@ -0,0 +1,3 @@
+export const numberWithinRange = (num: number, min: number, max: number) => {
+ return Math.min(Math.max(num, min), max)
+}