Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swiftxru/data-structs
Data structures implementations
https://github.com/swiftxru/data-structs
nodejs queue stack typescript
Last synced: 6 days ago
JSON representation
Data structures implementations
- Host: GitHub
- URL: https://github.com/swiftxru/data-structs
- Owner: swiftxru
- License: mit
- Created: 2022-09-30T12:32:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-30T15:25:10.000Z (about 2 years ago)
- Last Synced: 2024-02-23T03:44:31.724Z (10 months ago)
- Topics: nodejs, queue, stack, typescript
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Data structures
![ts](https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555)
![Size](https://img.shields.io/bundlephobia/minzip/@swiftx/data-structs)
![Version](https://img.shields.io/npm/v/@swiftx/data-structs)
![Downloads](https://img.shields.io/npm/dt/@swiftx/data-structs)## 📃 Description
Data structures implementations:
- Stack
- Queue## 📦 Getting Started
These instructions will get you setup to use `data-structs` in your project.
| | using NPM | using Yarn |
|-----------------:|--------------------------------------------|-----------------------------------------------|
| **Installation** | `npm i -D @swiftx/data-structs typescript` | `yarn add -D @swiftx/data-structs typescript` |## Usage
```typescript
import {Stack} from './stack';const stack = new Stack(4);
stack.push('one');
stack.push('two');
stack.push('three');
stack.push('four');
stack.push('five'); // Throws error, capacity is 4stack.size(); // Output: 4
stack.peek(); // Output: "four"
stack.size(); // Output: 4
stack.pop(); // Output: "four"
stack.size(); // Output: 3
```## Authors/maintainers
- **Klyuchevskiy Valeriy** - [vklyuche](https://github.com/vklyuche)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details