Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Added URL validation helper

Blue Mouse3e7ae4070b30
diff --git a/app/utils/validator.ts b/app/utils/validator.ts
index 4d6c8914d..dfd18665a 100644
--- a/app/utils/validator.ts
+++ b/app/utils/validator.ts
@@ -4,3 +4,12 @@ export const MAX_PASSWORD_CHARS = 50
export const isValidEmail = (text: string) => text.match(/^\S+@\S+\.\S+$/)
export const isValidPassword = (text: string) => text.length >= MIN_PASSWORD_CHARS
+
+export const isValidUrl = (text: string) => {
+ try {
+ new URL(text)
+ return true
+ } catch {
+ return false
+ }
+}