aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/lib/utils.ts
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-01-12 20:03:47 +0000
committerMohamed Bassem <me@mbassem.com>2025-01-12 20:03:47 +0000
commit9fd26b472b18924ab11afcebace90329b0fe3abf (patch)
tree04d2a8f8603978c27611574d663dfc58b3f285b0 /apps/web/lib/utils.ts
parentc5298cf4b43795c0c261922ef0ad0f20245be4d5 (diff)
downloadkarakeep-9fd26b472b18924ab11afcebace90329b0fe3abf.tar.zst
feat: Add ability to filter by bookmark type
Diffstat (limited to '')
-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]();
+}