MCPcopy
hub / github.com/angular/angular / parseUrl

Method parseUrl

packages/service-worker/worker/src/adapter.ts:93–98  ·  view source on GitHub ↗

* Parse a URL into its different parts, such as `origin`, `path` and `search`.

(url: string, relativeTo?: string)

Source from the content-addressed store, hash-verified

91 * Parse a URL into its different parts, such as `origin`, `path` and `search`.
92 */
93 parseUrl(url: string, relativeTo?: string): {origin: string; path: string; search: string} {
94 // Workaround a Safari bug, see
95 // https://github.com/angular/angular/issues/31061#issuecomment-503637978
96 const parsed = !relativeTo ? new URL(url) : new URL(url, relativeTo);
97 return {origin: parsed.origin, path: parsed.pathname, search: parsed.search};
98 }
99
100 /**
101 * Wait for a given amount of time before completing a Promise.

Callers 5

constructorMethod · 0.95
normalizeUrlMethod · 0.95
constructorMethod · 0.45
onFetchMethod · 0.45
newRequestWithMetadataFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected