# Module: dataArrayParsing

Contains all system defined business rules for parsing arrays specific to data.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 1

### Requires

- module:dataBroker
- module:ruleParsing
- module:loggers
- module:data
- @haystacks/constants
- path

### Methods

#### (inner) arrayDeepClone(inputData, inputMetaData) → {array.<(string|integer|boolean|float|object)>}

Clones an array by using JSON.stringify & JSON.parse. Almost all other methods of cloning an array will actually clone by reference which essentially just clones the pointer to the array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<(string|integer|boolean|float|object)> | The array that should be deeply cloned.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 258

##### Returns:

The new array object after being cloned deeply.

Type
  array.<(string|integer|boolean|float|object)>

#### (inner) arraysAreEqual(inputData, inputMetaData) → {boolean}

Determines if a set of arrays are equal or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<(string|integer|boolean|float|object)> | The first array that should be checked for equality.
`inputMetaData` | array.<(string|integer|boolean|float|object)> | The second array that should be checked for equality.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 30

##### Returns:

True or False to indicate if the arrays are equal or not equal.

Type
  boolean

#### (inner) getNamespacedDataObject(inputData, inputMetaData) → {object|boolean}

Navigates the D data structure JSON data object tree to find the namespace of data settings.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<string> | The path in the data JSON object where the setting should be returned.
`inputMetaData` | boolean | True or False value to indicate if the path elements should be created or not it they are not found.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 412

##### Returns:

The object found at the specified namespace address in the data object, or False if nothing was found.

Type
  object | boolean

#### (inner) getStoredData(inputData, inputMetaData) → {object}

Gets the named data stored in the D data structure in the DataStorage data hive.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The name of the sub-data hive that should contain the stored data we are looking for.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 80

##### Returns:

The data that was stored in the sub-data hive under the DataStorage data hive of the D data structure.

Type
  object

#### (inner) isArray(inputData, inputMetaData) → {boolean}

Determines if an object is an array or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | object | array.<(string|integer|boolean|float|object)> | The object that should be tested to see if it is an array or not.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 182

##### Returns:

True or False to indicate if the input object is an array or not.

Type
  boolean

#### (inner) isArrayEmpty(inputData, inputMetaData) → {boolean}

Determines if a JSON array is empty or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<(string|integer|boolean|float|object)> | The array that should be checked for emptiness.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 134

##### Returns:

True or False to indicate if the array is empty or not empty.

Type
  boolean

#### (inner) isArrayOrObject(inputData, inputMetaData) → {boolean}

Determines if an input object is either an array or a JSON object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | object | array.<(string|integer|boolean|float|object)> | The object that should be tested to see if it is either an array or a JSON object or not.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 206

##### Returns:

True or False to indicate if the input object is either an array or a JSON object.

Type
  boolean

#### (inner) isNonZeroLengthArray(inputData, inputMetaData) → {boolean}

Determines if an object is an array of length greater than or equal to one or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | object | array.<(string|integer|boolean|float|object)> | The object/array that should be tested to see if it is an array of length greater than or equal to 1 or not.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 232

##### Returns:

True or False to indicate if the input object is an array of length greater than equal to zero or not.

Type
  boolean

#### (inner) isObject(inputData, inputMetaData) → {boolean}

Determines if an object is a JSON object or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | object | array.<(string|integer|boolean|float|object)> | The object that should be tested to see if it is a JSON object or not.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 157

##### Returns:

True or False to indicate if the input object is an array or not.

Type
  boolean

#### (inner) isObjectEmpty(inputData, inputMetaData) → {boolean}

Determines if a JSON object is empty or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | object | The object that should be checked for emptiness.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 103

##### Returns:

True or False to indicate if the object is empty or not empty.

Type
  boolean

#### (inner) objectDeepMerge(inputData, inputMetaData) → {object}

Recursively deeply merges two objects that may or may not contains nested arrays.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | object | The target data to be merged with.
`inputMetaData` | object | The data that should be merged.

Author:
  - Pery Mimon
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 283

##### Returns:

The merged data after the merge is complete.

Type
  object

#### (inner) setNamespacedDataObject(inputData, inputMetaData) → {boolean}

Persists a change to the data structure.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<string> | The path in the data JSON object where the setting should be persisted.
`inputMetaData` | object | The data to be persisted on the D-data structure.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 461

##### Returns:

True or False to indicate if the data was persisted correctly or not.

Type
  boolean

#### (inner) storeData(inputData, inputMetaData) → {void}

Stores some data using the DataStorage data hie on the D data store.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The context name that the data should be stored with.
`inputMetaData` | string | integer | boolean | object | array | The data that should be stored.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/dataArrayParsing.js, line 56

##### Returns:

Type
  void