Private
Checks if the given object is an instance of the specified wikilink-related class.
This method is an alternative of the instanceof
operator, which cannot be used for
non-exported classes.
Example:
const [foo] = new mwbot.Wikitext('[[Foo]]').parseWikilinks();
foo instanceof mwbot.Wikilink; // true
mwbot.Wikilink.is(foo, 'ParsedWikilink'); // true
foo instanceof mwbot.FileWikilink; // false
mwbot.Wikilink.is(foo, 'ParsedFileWikilink'); // false
foo instanceof mwbot.RawWikilink; // false
mwbot.Wikilink.is(foo, 'ParsedRawWikilink'); // false
Be noted about the hierarchies of the wikilink-related classes:
The type of wikilink to check for. Must be one of 'Wikilink'
, 'ParsedWikilink'
,
'FileWikilink'
, 'ParsedFileWikilink'
, 'RawWikilink'
, or 'ParsedRawWikilink'
.
The object to check.
The wikilink type to compare against.
true
if obj
is an instance of the specified wikilink class, otherwise false
.
This interface defines the static members of the
ParsedWikilink
class. For instance members, see ParsedWikilink (defined separately due to TypeScript limitations).This class is exclusive to Wikitext.parseWikilinks. It represents a well-formed
[[wikilink]]
markup with a valid non-file title. For the class that represents a well-formed[[wikilink]]
markup with a valid file title, see ParsedFileWikilinkStatic, and for the class that represents a malformed[[wikilink]]
markup with an invalid title, see ParsedRawWikilinkStatic.This class differs from ParsedFileWikilink and ParsedRawWikilink in that:
The constructor of this class is inaccessible, and instances can only be referenced in the result of
parseTemplates
.To check if an object is an instance of this class, use WikilinkStatic.is.
Important:
The instance properties of this class are pseudo-read-only, in the sense that altering them does not affect the behaviour of Wikitext.modifyWikilinks.