pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/greybax/stack-data

> GitHub - greybax/stack-data: Simple stack imlementation on ES6 · GitHub
Skip to content

greybax/stack-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stack-data

Greenkeeper badge

NPM version Build Status Coveralls Status Dependency Status DevDependency Status

Simple stack implementation on ES6

Install

npm install --save stack-data

Usage

2 ways for adding element in stack:

  • in constructor new Stack(1,"2",3,[4, 5],6);
  • via push(elem) method

Also supports chaining mechanism like:

 new Stack()
 .push(1)
 .push(2)
 .push(3)
 .push(4)
 
 // creates object with 4 elements 1,2,3,4
// Examples of using stack-data

//Added stack elements in constructor
let preInitStack = new Stack(1,"2",3,[4, 5],6);
preInitStack.size;       //5

//Added elements classically via push()
let stack = new Stack();
stack.size;              //0
stack.push(1).push("2");
stack.size;              //2
stack.pop();             //"2"
stack.size;              //1
stack.peek();            //1
stack.size;              //1

API

push(elem)

push - Pushes element into stack. Throws an StackException when parameter is empty.

elem

Required
Type: Object

elem - object which will be putted into stack

pop()

pop - Takes top element from the stack. Throws an StackException when the stack is empty.

peek()

peek - Peeks at the top element of the stack. Throws an StackException when the stack is empty.

size

size - Returns the size of the stack.

License

MIT © Aleksandr Filatov greybax@gmail.com

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy