Methods
(inner) cleanHTML(htmlString) → {String}
Clean a string in HTML formatted strings that get created with the namespace tag in some browsers and not in others. Intended to facilitate testing.
Parameters:
Name | Type | Description |
---|---|---|
htmlString |
String | string to remove namespace from. |
Returns:
String without namespace.
- Type
- String
(inner) convertXMLToString(node) → {String}
Utility function to convert an XML DOM documents to a string useful for unit testing. This code is based on this SO answer
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | XML DOM object, usually as created by the document object. |
Returns:
Representation of the node object.
- Type
- String
(inner) escapeRegularExpression(regex) → {String}
Escape special characters in a string for use in a regular expression. Credits go to this SO answer
Parameters:
Name | Type | Description |
---|---|---|
regex |
String | string to escape for use in a regular expression. |
Returns:
String with escaped characters for use in a regular expression.
- Type
- String
(inner) naturalSort(list) → {Array.<String>}
Sorting function that deals with alpha and numeric elements.
Parameters:
Name | Type | Description |
---|---|---|
list |
Array.<String> | A list of strings to sort |
Returns:
The sorted list of strings
- Type
- Array.<String>
(inner) truncateLevel(lineage, levelIndex) → {String}
Utility function that splits the lineage into taxonomic levels and returns the taxonomic level specified
Parameters:
Name | Type | Description |
---|---|---|
lineage |
String | The taxonomic string, with levels seperated by semicolons. |
levelIndex |
Integer | The taxonomic level to truncate to. 1 = Kingdom, 2 = Phylum, etc. |
Returns:
The taxonomic string truncated to desired level.
- Type
- String