tsalgo
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

npm bundle size Stargazers Issues npm GitHub Workflow Status MIT License


TsAlgo

Typed data structures, algorithms, and utility functions library for JavaScript/TypeScript
Explore the docs » NPM »

Report Bug · Request Feature

Installation

  • Install with npm
    npm install tsalgo
  • or yarn
    yarn add tsalgo

Usage

import { LinkedList } from 'tsalgo';

or import all

import * as Collections from 'tsalgo';

All implementations use TypeScript generics.

Use with TypeScript instead of JavaScript to get complete Intellisense + type-safety.

import { LinkedList } from 'tsalgo';

const ll = new LinkedList<number>();

ll.push(100); // push adds to the end of the list
ll.push(200);
ll.push(300);

// Current state = 100 -> 200 -> 300

console.log(ll.shift()); // prints 100
console.log(ll.pop()); // prints 300
console.log(ll.size); // prints 1
console.log(ll.pop()); // prints 200
console.log(ll.size); // prints 0

Roadmap

Currently supported data structures:

  • LinkedList
    • DoublyLinkedList (default)
    • SinglyLinkedList
  • Stack
  • Queue
  • Heap
    • MinHeap (default)
    • MaxHeap
  • Priority Queue (Heap based)

This is a fairly new library, but I'm adding stuff everyday. See the open issues for a list of proposed features (and known issues).

Contributing

  1. Fork the Project
  2. Create your Feature Branch ( git checkout -b feature/something)
  3. Commit your changes with commitizen (to follow semantic versioning) (yarn commit or npm run commit)
  4. Push to the Branch (git push origin feature/something)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Package Sidebar

Install

npm i tsalgo

Weekly Downloads

12

Version

1.2.2

License

MIT

Unpacked Size

2.37 MB

Total Files

338

Last publish

Collaborators

  • goamaan