summaryrefslogtreecommitdiff
path: root/src/lib/util.js
diff options
context:
space:
mode:
authorjulian laplace <julescarbon@gmail.com>2023-05-10 15:13:47 +0200
committerjulian laplace <julescarbon@gmail.com>2023-05-10 15:13:47 +0200
commit7af6dfc46f9a94e3966cdfa4e0d353e989eb9070 (patch)
tree10ba8c83dd83dde4ffa74ec4fd7ce0868f145b70 /src/lib/util.js
parentec93f3236c39e03b993d0e15093ac354a20cb9ea (diff)
add stars and velocity
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();