Skip to content

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

ts
const pattern = new MatchPattern('*://google.com/*');

  pattern.includes('https://google.com'); // true
  pattern.includes('http://youtube.com/watch?v=123'); // false

Constructors

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

static PROTOCOLS: 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