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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

76 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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

  • πŸ“š Documentation - Complete guides and API reference
  • πŸ› Issues - Report bugs or request features
  • πŸ’¬ Discussions - Join the community

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

  •  
  •  
  •