npm install fixed-size-lifo --save
Create a LIFO of size 2
;let s = 2;ssize; // 0s; // 2s; // 0 items have been overflown due to the size limit
push / pop
push pushes an item into the stack; pop pops out the item from the top of the stack:
let s = 2;ssize; // 0s;s;ssize; // 2s; // 42ssize; // 1
peek can be used to look at elements from the top of the LIFO stack without modifying the stack.
s; // look at item from the top of the stacks; // same as aboves; // look at item 1 place below the top of the stack
peekBottom works just like peek except it looks at the bottom of the stack.
For more functions and examples look at the code (src/lib.js) and the test cases (test/test.js).