npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsa-with-javascript

v2.0.0

Published

Data Structures and Algorithms library with TypeScript support

Readme

DSA With JavaScript

dsa-with-javascript is a DSA library written in TypeScript that provides basic data structures like Stack, Queue and Linked List along with sorting, searching, and graph traversal algorithms. Works with JavaScript, TypeScript, Node.js, React, and Next.js.

Installation

npm install dsa-with-javascript

Usage

JavaScript (CommonJS)

const { Stack, BubbleSort } = require('dsa-with-javascript')

TypeScript / ES Modules

import { Stack, BubbleSort, LinkedList } from 'dsa-with-javascript'

All data structures support generics in TypeScript:

const stack = new Stack<number>()
const queue = new Queue<string>()
const list = new LinkedList<{ id: number; name: string }>()

Available Data Structures

1. Stack

import { Stack } from 'dsa-with-javascript'

const stack = new Stack<number>()
stack.push(10)      // Add element to top
stack.pop()         // Remove and return top element
stack.top()         // Return top element without removing
stack.isEmpty()     // Returns true if stack is empty
stack.show()        // Returns the stack as an array

2. Queue

import { Queue } from 'dsa-with-javascript'

const queue = new Queue<number>()
queue.push(10)      // Add element to rear
queue.pop()         // Remove and return front element
queue.top()         // Return front element without removing
queue.isEmpty()     // Returns true if queue is empty
queue.show()        // Returns the queue as an array

3. Linked List

import { LinkedList } from 'dsa-with-javascript'

const list = new LinkedList<number>()   // Empty list
const list2 = new LinkedList<number>(10) // List with initial value
list.createNew(20)   // Add new node with value 20
list.size()          // Returns the size
list.getFirst()      // Returns data of first node
list.getLast()       // Returns data of last node
list.popFirst()      // Remove and return first node's data
list.popLast()       // Remove and return last node's data
list.clear()         // Clear the list
list.show()          // Returns array of all node values

Available Algorithms

1. Binary Search

import { BinarySearch } from 'dsa-with-javascript'

const arr = [1, 2, 3, 4, 5]
BinarySearch(arr, 5)  // Returns index if found, -1 if not

The array is sorted automatically if not already sorted.

2. Linear Search

import { LinearSearch } from 'dsa-with-javascript'

const arr = [1, 2, 3, 4, 5]
LinearSearch(arr, 5)  // Returns index if found, -1 if not

3. BubbleSort

import { BubbleSort } from 'dsa-with-javascript'

BubbleSort([5, 3, 1, 4, 2])      // Ascending (default)
BubbleSort([5, 3, 1, 4, 2], -1)  // Descending

4. InsertionSort

import { InsertionSort } from 'dsa-with-javascript'

InsertionSort([5, 3, 1, 4, 2])      // Ascending
InsertionSort([5, 3, 1, 4, 2], -1)  // Descending

5. MergeSort

import { MergeSort } from 'dsa-with-javascript'

MergeSort([5, 3, 1, 4, 2])      // Ascending
MergeSort([5, 3, 1, 4, 2], -1)  // Descending

6. QuickSort

import { QuickSort } from 'dsa-with-javascript'

QuickSort([5, 3, 1, 4, 2])      // Ascending
QuickSort([5, 3, 1, 4, 2], -1)  // Descending

7. SelectionSort

import { SelectionSort } from 'dsa-with-javascript'

SelectionSort([5, 3, 1, 4, 2])      // Ascending
SelectionSort([5, 3, 1, 4, 2], -1)  // Descending

8. BreadthFirstSearch

import { BreadthFirstSearch } from 'dsa-with-javascript'

const graph = {
  A: ["B", "C"],
  B: ["A", "D", "E"],
  C: ["A", "F"],
  D: ["B"],
  E: ["B", "F"],
  F: ["C", "E"],
}
BreadthFirstSearch(graph, "A")  // Returns array of traversed nodes

9. DepthFirstSearch

import { DepthFirstSearch } from 'dsa-with-javascript'

const graph = {
  A: ["B", "C"],
  B: ["A", "D", "E"],
  C: ["A", "F"],
  D: ["B"],
  E: ["B", "F"],
  F: ["C", "E"],
}
DepthFirstSearch(graph, "A")  // Returns array of traversed nodes

Contributing

Pull requests are always welcome. For major changes, please open an issue first to discuss what you would like to change.

This library is a project created by Moh1tsingh.