moderator-toolbox-nxg-for-reddit / modules/domaintagger/matching
modules/domaintagger/matching¶
Functions¶
findTagForDomain()¶
findTagForDomain(
domain,domainTags):DomainTag|null
Defined in: extension/data/modules/domaintagger/matching.ts:31
Returns the first DomainTag matching domain, using this priority order:
Exact match (
domain === tag.name)Glob match (tag name contains
*, tested with matchesGlob)Suffix match (domain ends with the tag name) Returns
nullif no tag matches.
Parameters¶
domain¶
string
The full domain string to test (e.g. "i.imgur.com").
Returns¶
DomainTag | null
matchesGlob()¶
matchesGlob(
domain,pattern):boolean
Defined in: extension/data/modules/domaintagger/matching.ts:15
Tests whether domain matches a glob pattern. The pattern’s regex metacharacters are
escaped and each * is expanded to .*, then anchored to match the whole string.
Parameters¶
domain¶
string
The full domain string to test (e.g. "i.imgur.com").
pattern¶
string
A glob pattern containing at least one *.
Returns¶
boolean