(baseHref: string)
| 323 | } |
| 324 | |
| 325 | function _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 | } |
no test coverage detected
searching dependent graphs…