(aUrl: string)
| 416 | ...targetUrls: ReadonlyArray<string> |
| 417 | ): ((testUrl: string) => boolean) => { |
| 418 | const standardizeMatch = (aUrl: string) => { |
| 419 | aUrl = aUrl.toLowerCase(); |
| 420 | |
| 421 | const fileUrl = fileUrlToAbsolutePath(aUrl); |
| 422 | if (fileUrl) { |
| 423 | // Strip file:///, if present |
| 424 | aUrl = fileUrl; |
| 425 | } else if (isValidUrl(aUrl) && aUrl.includes('://')) { |
| 426 | // Strip the protocol, if present |
| 427 | aUrl = aUrl.substr(aUrl.indexOf('://') + 3); |
| 428 | } |
| 429 | |
| 430 | // Remove optional trailing / |
| 431 | if (aUrl.endsWith('/')) { |
| 432 | aUrl = aUrl.substr(0, aUrl.length - 1); |
| 433 | } |
| 434 | |
| 435 | return aUrl; |
| 436 | }; |
| 437 | |
| 438 | const escaped = targetUrls.map(url => |
| 439 | escapeRegexSpecialChars(standardizeMatch(url), '/*').replace(/\*/g, '.*'), |
no test coverage detected