API / wxt/utils/match-patterns / MatchPattern
Class: MatchPattern
Source: node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:11
Class for parsing and performing operations on match patterns.
Contents
Example
const pattern = new MatchPattern('*://google.com/*');
pattern.includes('https://google.com'); // true
pattern.includes('http://youtube.com/watch?v=123'); // falseConstructors
Constructor
new MatchPattern(
matchPattern):MatchPattern
Source: node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:23
Parse a match pattern string. If it is invalid, the constructor will throw an InvalidMatchPattern error.
Parameters
matchPattern
string
The match pattern to parse.
Returns
MatchPattern
Properties
PROTOCOLS
staticPROTOCOLS:string[]
Source: node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:12
Methods
includes()
includes(
url):boolean
Source: node_modules/.bun/@webext-core+match-patterns@2.0.0/node_modules/@webext-core/match-patterns/dist/index.d.mts:25
Check if a URL is included in a pattern.
Parameters
url
string | URL | Location
Returns
boolean
Generated using typedoc-plugin-markdown and TypeDoc