diff options
| author | Dhravya <[email protected]> | 2024-04-01 15:29:51 -0700 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-04-01 15:29:51 -0700 |
| commit | f5887dbbf91dfb2f5ab25975f8fdf0442bd0716c (patch) | |
| tree | cc249fc4cee270dc259c8c255ae32a727786b6cb /apps/web/src/lib/utils.ts | |
| parent | Merge branch 'main' of https://github.com/Dhravya/supermemory into new-ui (diff) | |
| parent | rename to PageItem (diff) | |
| download | supermemory-f5887dbbf91dfb2f5ab25975f8fdf0442bd0716c.tar.xz supermemory-f5887dbbf91dfb2f5ab25975f8fdf0442bd0716c.zip | |
Merge branch 'new-ui' of https://github.com/Dhravya/supermemory into new-ui
Diffstat (limited to 'apps/web/src/lib/utils.ts')
| -rw-r--r-- | apps/web/src/lib/utils.ts | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index d084ccad..6b8f3fd9 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -1,6 +1,19 @@ -import { type ClassValue, clsx } from "clsx" -import { twMerge } from "tailwind-merge" +"use client"; +import { type ClassValue, clsx } from "clsx"; +import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) + return twMerge(clsx(inputs)); +} + +// removes http(s?):// and / from the url +export function cleanUrl(url: string) { + if (url.endsWith("/")) { + url = url.slice(0, -1); + } + return url.startsWith("https://") + ? url.slice(8) + : url.startsWith("http://") + ? url.slice(7) + : url; } |