MCPcopy Index your code
hub / github.com/angular/angular / parseUrl

Function parseUrl

packages/service-worker/worker/testing/utils.ts:43–54  ·  view source on GitHub ↗
(
  url: string,
  relativeTo?: string,
)

Source from the content-addressed store, hash-verified

41 * Parse a URL into its different parts, such as `origin`, `path` and `search`.
42 */
43export function parseUrl(
44 url: string,
45 relativeTo?: string,
46): {origin: string; path: string; search: string} {
47 const parsedUrl: URL = !relativeTo ? new URL(url) : new URL(url, relativeTo);
48
49 return {
50 origin: parsedUrl.origin || `${parsedUrl.protocol}//${parsedUrl.host}`,
51 path: parsedUrl.pathname,
52 search: parsedUrl.search || '',
53 };
54}

Callers 2

constructorMethod · 0.90
normalizeUrlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…