Constructor
new mw.editcheck.TextMatchItem(item, id, collator)
#
TextMatchItem
Class to represent a single matchItem for TextMatchEditCheck
Parameters:
| Name | Type | Description |
|---|---|---|
item |
Object | Match item |
id |
string | ID of matchitem in config |
collator |
Intl.Collator | Collator to use for comparisons |
TextMatchItem
Class to represent a single matchItem for TextMatchEditCheck
Methods
getExpandedFragment(fragment) → {ve.dm.SurfaceFragment}
#
Expand a fragment given the match item's config
Parameters:
| Name | Type | Description |
|---|---|---|
fragment |
ve.dm.SurfaceFragment |
Returns:
Expanded fragment
getReplacement(term) → {string}
#
Return the corresponding replacement word, as defined for the given word in this matchItem's query
Parameters:
| Name | Type | Description |
|---|---|---|
term |
string | to get replacement for |
Returns:
replacement term
- Type
- string
Return the corresponding replacement word, as defined for the given word in this matchItem's query
getSubTag(term) → {string}
#
Get a unique subtag for this matchitem-term pair. Builds the subtag from:
- the index of the matchItem when created
- and, optionally, the index of the term in the list of keys from the matchItem's query
Parameters:
| Name | Type | Description |
|---|---|---|
term |
string |
Returns:
A subtag in the format '-{matchIndex}-{termIndex}'
- Type
- string
isCaseSensitive() → {boolean}
#
Returns:
if this matchItem is configured to be case sensitive
- Type
- boolean
normalizeQuery(query) → {Object.<string, string>}
#
Transform any query type into a dictionary of terms and their replacements, with a null replacement if none exists
Parameters:
Returns:
Dictionary of each term and its replacement
- Type
- Object.<string, string>
Transform any query type into a dictionary of terms and their replacements, with a null replacement if none exists