JSDoc: Module: utility-functions

# Module: utility-functions

### 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.

Source:
  - util.js, line 128

##### 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.

Source:
  - util.js, line 68

##### 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.

Source:
  - util.js, line 113

##### 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

Source:
  - util.js, line 3

##### 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.

Source:
  - util.js, line 38

##### Returns:

The taxonomic string truncated to desired level.

Type
  String