summaryrefslogtreecommitdiff
path: root/packages/integrations/markdoc/src/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/markdoc/src/utils.ts')
-rw-r--r--packages/integrations/markdoc/src/utils.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/src/utils.ts b/packages/integrations/markdoc/src/utils.ts
index 275c711f0..9d6e5af26 100644
--- a/packages/integrations/markdoc/src/utils.ts
+++ b/packages/integrations/markdoc/src/utils.ts
@@ -145,3 +145,12 @@ const componentsPropValidator = z.record(
export function isCapitalized(str: string) {
return str.length > 0 && str[0] === str[0].toUpperCase();
}
+
+export function isValidUrl(str: string): boolean {
+ try {
+ new URL(str);
+ return true;
+ } catch {
+ return false;
+ }
+}