aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/lib/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/lib/utils.ts')
-rw-r--r--apps/web/lib/utils.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/web/lib/utils.ts b/apps/web/lib/utils.ts
index 12207765..230c9eef 100644
--- a/apps/web/lib/utils.ts
+++ b/apps/web/lib/utils.ts
@@ -29,3 +29,17 @@ export function getOS() {
}
return os;
}
+
+export function match<T extends string | number | symbol, U>(
+ val: T,
+ options: Record<T, U>,
+) {
+ return options[val];
+}
+
+export function matchFunc<T extends string | number | symbol, U>(
+ val: T,
+ options: Record<T, () => U>,
+) {
+ return options[val]();
+}