MCPcopy Create free account
hub / github.com/dailydotdev/apps / isValidHttpUrl

Function isValidHttpUrl

packages/shared/src/lib/links.ts:46–54  ·  view source on GitHub ↗
(link: string)

Source from the content-addressed store, hash-verified

44}): string => `${webappUrl}posts/${post.slug || post.id}`;
45
46export function isValidHttpUrl(link: string): boolean {
47 try {
48 const url = new URL(link);
49
50 return url.protocol === 'http:' || url.protocol === 'https:';
51 } catch (_) {
52 return false;
53 }
54}
55
56const validSchema = ['http:', 'https:'];
57export const withHttps = (url: string): string =>

Callers 10

useMentionAutocompleteFunction · 0.90
SubmitExternalLinkFunction · 0.90
getSafeCommentUrlFunction · 0.90
ShortcutEditFormFunction · 0.90
parseUrlLineFunction · 0.90
checkMentionFunction · 0.90
onPasteFunction · 0.90
useDebouncedUrlFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected