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

Function _stripOrigin

packages/common/src/location/location.ts:325–337  ·  view source on GitHub ↗
(baseHref: string)

Source from the content-addressed store, hash-verified

323}
324
325function _stripOrigin(baseHref: string): string {
326 // DO NOT REFACTOR! Previously, this check looked like this:
327 // `/^(https?:)?\/\//.test(baseHref)`, but that resulted in
328 // syntactically incorrect code after Closure Compiler minification.
329 // This was likely caused by a bug in Closure Compiler, but
330 // for now, the check is rewritten to use `new RegExp` instead.
331 const isAbsoluteUrl = new RegExp('^(https?:)?//').test(baseHref);
332 if (isAbsoluteUrl) {
333 const [, pathname] = baseHref.split(/\/\/[^\/]+/);
334 return pathname;
335 }
336 return baseHref;
337}

Callers 1

constructorMethod · 0.85

Calls 1

testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…