Constructor
new Stanza(strings, values)
Parameters:
Name | Type | Description |
---|---|---|
strings |
Array.<string> | |
values |
Array.<any> |
Classes
Members
(private) string :string
Type:
- string
(private) strings :Array.<string>
Type:
- Array.<string>
Methods
toString() → {string}
Returns:
- Type
- string
(static) toElement(string, throwErrorIfInvalidNSopt) → {Element}
Turns the passed-in string into an XML Element.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
string |
string | ||
throwErrorIfInvalidNS |
boolean |
<optional> |
Returns:
- Type
- Element
(static) unsafeXML(string) → {Builder}
A directive which can be used to pass a string of XML as a value to the stx tagged template literal.
It's considered "unsafe" because it can pose a security risk if used with untrusted input.
Parameters:
Name | Type | Description |
---|---|---|
string |
string |
Returns:
- Type
- Builder
Example
const status = '<status>I am busy!</status>';
const pres = stx`
<presence from='juliet@example.com/chamber' id='pres1'>
<show>dnd</show>
${unsafeXML(status)}
</presence>`;
connection.send(pres);