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

ds-structures

v0.0.8

Published

It is a javascript library which contains almost all the data structures and algorithms.

Readme

Data Structues

data-structures and commonly used algorithms written in plain javascript, for eg Lists,stacks,queue etc.

Upcoming features Priority Queue, Trees,Trie(ds),Sorting Alogorithms,Searching Algorithms, Path Algorithms,Matrics...

Getting Started With List

How To Import for versions less than 0.0.7

const {List,Queue,Stack} = require('ds-structures');

importing in versions greater than 0.0.6

const {List,Stack,LinkList,Queue} from 'ds-structures/compiled';

List Examples

Creating A List

const list = new List(1,2,3,4,'a','b','c') create a list of [1,2,3,4,a,b,c]

Retreving A List

list.get(); //Returs the list;

get element at particular index

list.get(index) // returns element at particular index;

Add data to list

list.push(value) // pushes the value to your list and returns the list

Add data to the front of the list

list.pushFront(value) // adds the value at the 0 index of the list

Check element is in the list

list.contains(value) // returns true if value is present in the list or returns false

Removing element at the last index of the list

list.popEnd(); // removes the last element of the list and returns the rest of the list;

Removing element at the 0 index of the list

list.popFront() // removes the element at the 0 index and returns the rest of the list;

Removing element from the list

list.remove(element) // this will remove the first occurance of  element from the list and returns the rest of the list, element should be the value not the index;

Removing element at particular index

list.splice(index) // removes the element at the given index and returns the rest of the list

Removing all the duplicates;

list.removeDuplicates(); // returns the unique list of elements 

Filtering from the list

filter based on mode -> two modes are there i.e (number and string ) mode

filter all the numbers from the list

list.filter('number') // filters all the numbers and returns the list without number , it may contain characters 

filter all the strings from the list

list.filter('string') // returns all the numbers;

filter an element

list.filter(element) // returns the list without containing this element

filter and list of elements

list.filter(new List('a',1,'b')) // returns the list without containing the new filter list

push element at particular index

list.pushAt(element,index) // pushes the given element at the given index , if index is not present pushFront is called

fill the array

list.fill(element,topIndex,bottomIndex) // fills the array with the given element from  bottomIndex till topIndex, bottomIndex default is 0

Getting Started With Stack

How To Import

const {Stack} = require('ds-structures');

Stack Examples

Create Instance Of Stack

const stack = new Stack(size_of_stack);

Push element to stack

stack.push(element) // returns the updated stack 

Pop element from stack

stack.pop(element) // returns the updated stack

Peek

stack.peek() // returns peek element from the stack

Check OverFlow

stack.stackOverFlow() // returns true if the stack is full else false

Check UnderFlow

stack.stackUnderFlow() // returns true if stack is empty else false;

extend the size of stack

stack.extend(your_new_stack_size)

Getting Started With Queue

const {Queue} = require('ds-structures');
 const queue = new Queue();

Pushing Element To Queue(enqueue)

queue.enqueue(item) // pushes item to the end of the queue

Removing Element From Queue(dequeue)

queue.dequeue(); // removes the first item from the queue;

Get the front item from queue;

queue.first // returns the front element from queue

Get the last item from queue

queue.last // returns the last element of the queue

Get the queue size

queue.size // returns the size of queue
Linked List Examples

Getting Started With The LinkedList

const {LinkList} = require('ds-structure');

const myLinkList = new LinkList();

Set NextNode

myLinkList.setNext(10) // create the node having 10 as value and inserts in the linkList

traverse the linkList

myLinkList.traverse() // traverses the linkList and returns the list of linkList data

get the head node

myLinkList.getHead // returns the head node
myLinkList.getHead.getData()  // data at the head node
myLinkList.getHead.setData(data) // sets the data at the head Node

get the tail node

myLinkList.getTail // returns the tail of the linkList
myLinkList.getTail.getData() // returns the data at the tail node
myLinkList.getTail.setData(data) // sets the data at the tail node

insert the data at a particular node

myLinkList.insertAt(index,data) // inserts the data at the given index and pushes back the previous data at that node

delete the node at the particular index

myLinkList.deleteAt(index) // removes the node at that index