(currentUrl, pattern)
| 127 | * Match a URL string against a glob-style pattern (supports `*` wildcards). |
| 128 | */ |
| 129 | export function matchUrl(currentUrl, pattern) { |
| 130 | if (!pattern || !currentUrl) return false |
| 131 | return patternToRegex(pattern).test(currentUrl) |
| 132 | } |
| 133 | |
| 134 | function patternToRegex(pattern) { |
| 135 | const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&') |
no test coverage detected