An implementation of a simple stack class.
npm install simple-data-stack
* SimpleStack
* ~SimpleStack
* new SimpleStack()
* .toString()
* ~push(element)
* ~peek() ⇒ Object
* ~pop() ⇒ Object
* ~clear()
* ~length() ⇒ Number
* ~clone() ⇒ Object
SimpleStack * ~SimpleStack
* new SimpleStack()
* .toString()
#### new SimpleStack()
Represents a stack.
| Param | Description |
| --- | --- |
| ...arguments | [Optional] Initial elements in the stack. |
#### simpleStack.toString()
Overrides Object.prototype.toString to throw errors.
Kind: instance method of SimpleStack
Throws:
- Will throw an error in lieu of coercing stack into a string.
- Will throw an error if the stack is empty.
Kind: inner method of SimpleStack
Throws:
- Will throw an error if an element is not supplied.
| Param | Description |
| --- | --- |
| element | An element. |
Kind: inner method of SimpleStack
Returns: Object - Element at the top of the stack
Throws:
- Will throw an error if the stack is empty.
Kind: inner method of SimpleStack
Returns: Object - Popped element
Throws:
- Will throw an error when the stack is empty.
Kind: inner method of SimpleStack
Kind: inner method of SimpleStack
Returns: Number - Stack length
Kind: inner method of SimpleStack
Returns: Object - Cloned new SimpleStack object