https://github.com/jakenherman/kcats
A stack implementation for node
https://github.com/jakenherman/kcats
data-structures node-module stack
Last synced: 7 months ago
JSON representation
A stack implementation for node
- Host: GitHub
- URL: https://github.com/jakenherman/kcats
- Owner: JakenHerman
- Created: 2016-10-06T22:56:11.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-11-13T19:14:20.000Z (almost 6 years ago)
- Last Synced: 2025-01-30T09:44:06.602Z (9 months ago)
- Topics: data-structures, node-module, stack
- Language: JavaScript
- Homepage: http://jakenherman.github.io/kcats/
- Size: 404 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kcats
A stack implementation for node
[](https://nodei.co/npm/kcats.png)
[](https://travis-ci.org/JakenHerman/kcats)
## Installation
`npm install kcats`
## Usage
`var kcats = require("kcats")`
Then use `var stack_name = new kcats(10, 2);` where `10`, here, is the maximum size of the total stack space, and `2` is how many stacks are created. Multiple stacks are created in one array. So the array will be 10 spaces, and stack 1 will be array space 0-4, and stack 2 will be array space 5-9. Of course, there can be more than 2 stacks.
## API
- `stack_name._isEmpty(stack_number)` -> Boolean : Determines whether or not the stack contains anything.
- `stack_name._reset(stack_number)` -> Void : Allows you to instantaneously pop all elements, without printing them.
- `stack_name._isFull(stack_number)` -> Boolean : Determines whether or not the stack is full.
- `stack_name._push(item, stack_number)` -> Void : Allows you to add an item to the stack.
- `stack_name._pop(stack_number)` -> Item : Allows you to retrieve the element at the top of the stack.
- `stack_name._peek(stack_number)` -> Item : Allows you to print the element at the top of the stack without removing it.