MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / extractUrlPath

Function extractUrlPath

src/utils/urlDecoder.tsx:11–19  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

9}
10
11export function extractUrlPath(input: string): string | null {
12 try {
13 const normalizedInput = input.startsWith('http') ? input : `https://${input}`;
14 const url = new URL(normalizedInput);
15 return url.pathname.replace(/^\/|\/$/g, ''); // Remove leading and trailing slashes
16 } catch {
17 return null; // Not a valid URL
18 }
19}

Callers 2

parseRepositoryInputFunction · 0.90
RepoWikiPageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected