Skip to content

List of type-safe and commonly used Data structures which are not provided natively by Javascript/Typescript

License

Notifications You must be signed in to change notification settings

mandy8055/data-structures

data-structures

A comprehensive collection of type-safe, zero-dependency data structure implementations for TypeScript/JavaScript.

JSR JSR Score npm version npm bundle size codecov CI

Visit our comprehensive documentation site for detailed guides, API references, and examples.

Quick Start

Installation

npm:

npm install @msnkr/data-structures

Deno (JSR):

import { Queue, LRUCache } from 'jsr:@mskr/data-structures';

Example

import { Queue, LRUCache } from '@msnkr/data-structures';

// FIFO Queue
const queue = new Queue<number>();
queue.enqueue(1);
queue.enqueue(2);
console.log(queue.dequeue()); // 1

// LRU Cache
const cache = new LRUCache<string, number>({ capacity: 100 });
cache.put('key', 42);
console.log(cache.get('key')); // 42

Data Structures

  • Queues: Queue, Deque, PriorityQueue
  • Lists: LinkedList, DoublyLinkedList
  • Heaps: BinaryHeap (MinHeap, MaxHeap)
  • Trees: Trie, RedBlackTree
  • Maps & Caches: SortedMap, BiDirectionalMap, LRUCache

Features

  • 🎯 Type Safety - Full TypeScript support with generics
  • 📦 Zero Dependencies - Lightweight and secure
  • Performance - Optimized implementations with documented time complexities
  • 🧪 Well Tested - Comprehensive test coverage (>85%)
  • 🌲 Tree Shakeable - Import only what you need
  • 🔄 Dual Published - Available on both JSR and npm

Links

License

MIT License - feel free to use this in your own projects!

About

List of type-safe and commonly used Data structures which are not provided natively by Javascript/Typescript

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •