summaryrefslogtreecommitdiff
path: root/src/lib/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util.js')
-rw-r--r--src/lib/util.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib/util.js b/src/lib/util.js
index 7980220..ff6dcf5 100644
--- a/src/lib/util.js
+++ b/src/lib/util.js
@@ -11,6 +11,7 @@ const isDesktop = !isMobile;
document.body.classList.add(isMobile ? "mobile" : "desktop");
export const browser = { isIphone, isIpad, isMobile, isDesktop };
+export const clamp = (n, a, b) => (n < a ? a : n < b ? n : b);
export const choice = (a) => a[Math.floor(Math.random() * a.length)];
export const mod = (n, m) => n - m * Math.floor(n / m);
export const random = () => Math.random();