Private
Private
Optional
options: ParsedTemplateOptionsChecks if the given object is an instance of the specified template-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}}').parseTemplates();
foo instanceof mwbot.Template; // true
mwbot.Template.is(foo, 'ParsedTemplate'); // true
mwbot.Template.is(foo, 'RawTemplate'); // false
foo instanceof mwbot.ParserFunction; // false
mwbot.Template.is(foo, 'ParsedParserFunction'); // false
Be noted about the hierarchies of the template-related classes:
The type of template to check for. Must be one of 'Template'
, 'ParsedTemplate'
,
'RawTemplate'
, 'ParserFunction'
, or 'ParsedParserFunction'
.
The object to check.
The template type to compare against.
true
if obj
is an instance of the specified template class, otherwise false
.
This interface defines the static members of the
ParsedTemplate
class. For instance members, see ParsedTemplate (defined separately due to TypeScript limitations).This class is exclusive to Wikitext.parseTemplates. It represents a well-formed
{{template}}
markup with a valid title. For the class that represents a malformed{{template}}
markup with an invalid title, see RawTemplateStatic.This class differs from RawTemplate 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 TemplateStatic.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.modifyTemplates.