@onesy/stack
v1.0.0
Published
Stack
Downloads
69
Maintainers
Readme
Getting started
Add
yarn add @onesy/stack
Use cases
- Reversing
- Undo/redo
- Backtracking
- Call stack
- etc.
Use
import OnesyStack from '@onesy/stack';
// Make a new stack instance
const onesyStack = new OnesyStack();
// Add values
onesyStack.push(1, 2, 3, 4);
onesyStack.first;
// 4
onesyStack.length;
// 4
const value = onesyStack.pop();
value;
// 4
onesyStack.first;
// 3
onesyStack.length;
// 3
Dev
Install
yarn
Test
yarn test
Prod
Build
yarn build