Global

Methods

addChild(parentNode, childNode)

Source:

Adds a node as a child of the parent node. This function mutates the parentNode

Parameters:
Name Type Description
parentNode object

JS object that may or may not include elements key

childNode object

JS object to add to push to parentNode's children

convertJsObjectToXML(jsObj) → {string}

Source:

Converts a JS object to an XML string

Parameters:
Name Type Description
jsObj xmlJs.Element

The JS object to convert

Returns:

The XML string representation of the JS object

Type
string

convertXmlStringToJS(xmlString) → {xmlJs.Element}

Source:

Converts an XML string to a JS object

Parameters:
Name Type Description
xmlString string

The XML string to convert

Returns:

The JS object representation of the XML string

Type
xmlJs.Element

findNodesRecursively(nodes, discriminatorFunction) → {Array.<object>}

Source:

Finds nodes and its child nodes recursively based on a given discriminator function

Parameters:
Name Type Description
nodes Array.<object>

JS objects to search recursively through

discriminatorFunction function

Function to determine if the node should be returned in the found list

Returns:

The nodes matching the search criteria

Type
Array.<object>

getAllNodesRecursively(htmlDocument) → {Array.<JSDOM.Node>}

Source:

Traverses the document tree to return an array of all the nodes

Parameters:
Name Type Description
htmlDocument JSDOM.Document

The html document

Returns:

The array of nodes

Type
Array.<JSDOM.Node>