# Module: stack

Implements the various functions of a stack data structure, using the specified namespace on the D-data structure.

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

### Requires

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

### Methods

#### (inner) clearStack(stackNameSpace) → {void}

Clears all contents of the stack so it can start fresh. It does not delete the stack completely!

##### Parameters:

Name | Type | Description
--- | --- | ---
`stackNameSpace` | string | The namespace for the stack that should be cleared.

Author:
  - Seth Hollingsead
Source:
  - structures/stack.js, line 51

##### Returns:

Type
  void

#### (inner) contains(stackNameSpace, value) → {boolean}

Determines if the specified stack contains the specified value.

##### Parameters:

Name | Type | Description
--- | --- | ---
`stackNameSpace` | string | The namespace of the stack that should be searched for the specified value.
`value` | string | integer | object | array | The value/object that should be searched to see if it exists on the specified stack or does not exist.

Author:
  - Seth Hollingsead
Source:
  - structures/stack.js, line 181

##### Returns:

True or False to indicate if the value/object exists or does not exist.

Type
  boolean

#### (inner) initStack(stackNameSpace) → {void}

Initializes the stack with the provided namespace.

##### Parameters:

Name | Type | Description
--- | --- | ---
`stackNameSpace` | string | The namespace the Stack array should be created under.

Author:
  - Seth Hollingsead
Source:
  - structures/stack.js, line 29

##### Returns:

Type
  void

#### (inner) isEmpty(stackNameSpace) → {boolean}

Determines if the stack specified by the namespace parameter is empty or not empty.

##### Parameters:

Name | Type | Description
--- | --- | ---
`stackNameSpace` | string | The namespace of the stack that should be checked if it is empty or not empty.

Author:
  - Seth Hollingsead
Source:
  - structures/stack.js, line 129

##### Returns:

True or False to indicate if the specified stack is empty or not empty.

Type
  boolean

#### (inner) length(stackNameSpace) → {integer}

Gets the length of the stack specified by the namespace parameter.

##### Parameters:

Name | Type | Description
--- | --- | ---
`stackNameSpace` | string | The namespace of the stack that should return a length property.

Author:
  - Seth Hollingsead
Source:
  - structures/stack.js, line 156

##### Returns:

A value that represents a count of the number of entities on the specified stack.

Type
  integer

#### (inner) pop(stackNameSpace) → {string|integer|boolean|object|array}

Pops some data off the stack identified by the namespace input parameter.

##### Parameters:

Name | Type | Description
--- | --- | ---
`stackNameSpace` | string | The namespace of the stack that should be used to pop the data and return it.

Author:
  - Seth Hollingsead
Source:
  - structures/stack.js, line 97

##### Returns:

Whatever data was stored at the top of the stack.

Type
  string | integer | boolean | object | array

#### (inner) print(stackNameSpace) → {void}

Prints out the stack as specified by the namespace input parameter.

##### Parameters:

Name | Type | Description
--- | --- | ---
`stackNameSpace` | string | The namespace that should be used to print out the contents of the stack on the D-data structure.

Author:
  - Seth Hollingsead
Source:
  - structures/stack.js, line 207

##### Returns:

Type
  void

#### (inner) push(stackNameSpace, value) → {void}

Pushes some data on the stack identified by the namespace input parameter.

##### Parameters:

Name | Type | Description
--- | --- | ---
`stackNameSpace` | string | The namespace of the stack that should be used to push the data onto.
`value` | string | integer | boolean | object | array | The data that should be pushed on the stack.

Author:
  - Seth Hollingsead
Source:
  - structures/stack.js, line 73

##### Returns:

Type
  void