Expand all

mw.editcheck.TextMatchItem

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

Source:

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
Source:

Returns:

Expanded fragment

Type
ve.dm.SurfaceFragment
Expand a fragment given the match item's config

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

Source:

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
Source:

Returns:

A subtag in the format '-{matchIndex}-{termIndex}'

Type
string
Get a unique subtag for this matchitem-term pair.

isCaseSensitive() → {boolean} #

Source:

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:

Name Type Description
query Object.<string, string> | Array.<string> | string
Source:

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