# Module: ruleParsing

Contains a function that can be used by the business rules to call business rules internal to business rules.

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

### Requires

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

### Methods

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

Determines if al the rules in an array of rule names all exist in the runtime rules data structure or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<string> | The array of rule names that should be validated for existence in the runtime rules data structure.
`inputMetaData` | string | Not used by this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/ruleParsing.js, line 27

##### Returns:

A True or False value to indicate if all the rules in the input array exist or do not all exist.

Type
  boolean

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

Determines if a specified named rule exists in the rules system or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The rule name that should be validated as existing in the runtime rules data structure.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/ruleParsing.js, line 61

##### Returns:

A True or False value to indicate if the rule exists or does not exist.

Type
  boolean

#### (inner) getRule(inputData, inputMetaData) → {function}

If the rule is a real rule, then return the function object, so it can be used as a call-back function.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The name of the rule that should be returned if it exists as a valid rule name.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/ruleParsing.js, line 87

##### Returns:

The function that was found if it exists or False if no rule is found.

Type
  function

#### (inner) processRulesInternal(inputData, inputMetaData) → {string|integer|boolean|object|function}

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | array.<(string|integer|boolean|object|function()), (string|integer|boolean|object|function())> | An array of inputs, inputData & inputMetaData. inputData[0] = inputData - The primary input data that should be processed by the business rule. inputData[1] = inputMetaData - Additional meta-data that should be used when processing the business rule.
`inputMetaData` | array.<string> | The name(s) of the rule(s) that should be executed for modifying the input data.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/ruleParsing.js, line 113

##### Returns:

A modified data Object/String/Integer/Boolean/Function where the data has been modified based on the input data, input meta-data, and business rule that was executed.

Type
  string | integer | boolean | object | function