# Module: commandArrayParsing

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

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

### Requires

- module:ruleParsing
- module:configurator
- module:loggers
- @haystacks/constants
- path

### Methods

#### (inner) aggregateCommandArguments(inputData, inputMetaData) → {string}

Combines all of the input arguments into a single command line to be executed by the command parser.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<string> | An array of strings that represents the command and command parameters to execute.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/commandArrayParsing.js, line 324

##### Returns:

A sinle string command line of code that should be sent to the command parser.

Type
  string

#### (inner) generateCommandAliases(inputData, inputMetaData) → {string}

Generates all possible combinations of command aliases given a set of command words and command word abbreviations.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | object | An object containing all of the meta-data needed for command words and command word abbreviations needed to generate every possible combination of command aliases.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/commandArrayParsing.js, line 230

##### Returns:

A coma-separated list of every possible combination of command aliases.

Type
  string

#### (inner) getLehmerCodeValue(inputData, inputMetaData) → {string}

Takes a Lehmer code array and an array of arrays and uses the Lehmer Code array to look up the corresponding values in the array of arrays.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<integer> | The Lehmer code array with indices for values we should get & return.
`inputMetaData` | array.<array.<string>> | The nested array of arrays with the values we should get and combine then return as a single string.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/commandArrayParsing.js, line 192

##### Returns:

The joined string from each of the array element strings at the Lehmer code indices.

Type
  string

#### (inner) recursiveArrayExpansion(inputData, inputMetaData) → {array.<array.<integer>>}

Recursively expands all possible combinations of an input array given an index of expansion and returns the list of arrays.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<integer, array.<integer>> | The index of expansion and the array to be expanded as an array object.
`inputMetaData` | array.<integer> | The Lehmer Codex that should be used to set the limit of expansion based on the index of expansion.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/commandArrayParsing.js, line 78

##### Returns:

The final list of arrays after the array expansion has completed successfully.

Type
  array.<array.<integer>>

#### (inner) solveLehmerCode(inputData, inputMetaData) → {string}

Used the inputData as an addressable Lehmer Code to find all possible combinations of array elements.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<integer> | The Lehmer code addressable index array we will use to permutate over all possible combinations.
`inputMetaData` | array.<array.<string>> | The nested array that contains all instances of strings that should be used when generating permutations.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/arrayParsing/commandArrayParsing.js, line 28

##### Returns:

The delimited list of possible combinations generated by solving the Lehmer Code.

Type
  string