avkrash-stack
v0.1.0
Published
Dynamical data structure - Stack
Downloads
2
Readme
JS Test Task #3: Stack (avkrash-stack)
Stack is dynamical data structure add-on to JS that allows you to create stacks and work with them.
Module description
Initializing the list
const Stack = require('avkrash-stack');
var stack = new Stack();
Adding elements to the stack
stack.push(15);
stack.push({'foo':1,'bar':'tender'});
See top element of stack
stack.peek(); //returns '15'
stack.peek(); //returns '15'
Take top element from stack and show it value
stack.pop(); //returns '15' and removes top element
stack.peek(); //returns "{'foo':1,'bar':'tender'}"
stack.pop(); //returns "{'foo':1,'bar':'tender'}" and removes last element from stack
Check if stack is empty
stack.isEmprty(); //returns 'true'
Getting started
Install
npm install avkrash-stack
Running tests
npm test
P.S.: for additional info see JSDocs