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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@surya.iitg/linkedlist

v0.2.0

Published

generic linked list implementation

Readme

About

linkedlist : A (doubly) linked list implementation in javascript

Installation

linkedlist does not have any dependencies

npm i @surya.iitg/linkedlist --save

Usage

  const LinkedList = require('@surya.iitg/linkedlist');
  
  (() => {
    let ll = new LinkedList();
  
    const exampleArray = [1, 2, 3, 4, 5];
  
    ll.setArray(exampleArray);
  
    console.log('Array representation: ',  ll.getArray());
  
    ll.insertAtBeginning(0);
  
    console.log('\nArray representation 1 : ',  ll.getArray());
  
    ll.insertAtEnd(6);
  
    console.log('\nArray representation 2 : ',  ll.getArray());
  })();

/*
Array representation:  [ { id: 'ad429afd-a0e4-46d2-55ca-916c9227d3d3', data: 1 },
  { id: 'bda43028-74f8-e65f-bda1-e96ec5978a7d', data: 2 },
  { id: 'cc66f555-9d4f-deef-a841-652d36680aea', data: 3 },
  { id: '3bff7da8-712e-898a-37ab-ce7a5aa2b90d', data: 4 },
  { id: '8ffb7572-c2ca-9ede-037a-45bc3114f2f8', data: 5 } ]

Array representation 1 :  [ { id: '41b85570-67c6-7bb6-eed0-d39f30f09f68', data: 0 },
  { id: 'ad429afd-a0e4-46d2-55ca-916c9227d3d3', data: 1 },
  { id: 'bda43028-74f8-e65f-bda1-e96ec5978a7d', data: 2 },
  { id: 'cc66f555-9d4f-deef-a841-652d36680aea', data: 3 },
  { id: '3bff7da8-712e-898a-37ab-ce7a5aa2b90d', data: 4 },
  { id: '8ffb7572-c2ca-9ede-037a-45bc3114f2f8', data: 5 } ]

Array representation 2 :  [ { id: '41b85570-67c6-7bb6-eed0-d39f30f09f68', data: 0 },
  { id: 'ad429afd-a0e4-46d2-55ca-916c9227d3d3', data: 1 },
  { id: 'bda43028-74f8-e65f-bda1-e96ec5978a7d', data: 2 },
  { id: 'cc66f555-9d4f-deef-a841-652d36680aea', data: 3 },
  { id: '3bff7da8-712e-898a-37ab-ce7a5aa2b90d', data: 4 },
  { id: '8ffb7572-c2ca-9ede-037a-45bc3114f2f8', data: 5 },
  { id: '350fa9a6-259b-9e83-29a7-9c537c748526', data: 6 } ]
*/

API


/**
 Returns the element with a given id

 @param {Number} id Id of the element
 @return {NodeElement | null} Node Element with given id or null if not found
 @memberOf LinkedList
 */

getById(id);

/**
 Returns the element with at given index

 @param {Number} index index of the element
 @return {NodeElement | null} Node Element at given index or null if not found
 @memberOf LinkedList
 */
getAt(index);

/**
 Returns array representation of the list

 @return {Array}
 @memberOf LinkedList
 */
getArray();

/**
 Append the elements of an Array to list

 @param {Array} array array to be appended
 @memberOf LinkedList
 */
setArray(array);

/**
 Insert a node at the beginning of the list

 @param {String | Number | Object} data data for the new Node
 @param {String | Number} newNodeElementId id for the new Node
 @return {NodeElement} return the newly created node
 @memberOf LinkedList
 */
insertAtBeginning(data = '', newNodeElementId);

/**
 Insert a node after a given element by id

 @param {String | Number} id of the node after which new node will be inserted
 @param {String | Number | Object} data data for the new Node
 @param {String | Number} newNodeElementId id for the new Node
 @return {NodeElement} return the newly created node
 @memberOf LinkedList
 */
insertAfterId(id, data = '', newNodeElementId);

/**
 Insert a node at a given index

 @param {Number} index at which node will be inserted
 @param {String | Number | Object} data data for the new Node
 @param {String | Number} newNodeElementId id for the new Node
 @return {NodeElement} return the newly created node
 @memberOf LinkedList
 */
insertAt(index, data = '', newNodeElementId);

/**
 Insert a node at the last location

 @param {String | Number | Object} data data for the new Node
 @param {String | Number} newNodeElementId id for the new Node
 @return {NodeElement} return the newly created node
 @memberOf LinkedList
 */
insertAtEnd(data = '', newNodeElementId);

/**
 Delete the first node

 @return {NodeElement} return the deleted node
 @memberOf LinkedList
 */
deleteFirstNode();

/**
 Delete the node by id

 @param {String | Number} id of the node to be deleted
 @return {NodeElement | null} return the deleted node or null if not found
 @memberOf LinkedList
 */
deleteById(id);

/**
 Delete the node by index

 @param {Number} index of the node to be deleted
 @return {NodeElement | null} return the deleted node or null if not found
 @memberOf LinkedList
 */
deleteAt(index);

/**
 Delete the last node

 @return {NodeElement | null} return the deleted node or null if not found
 @memberOf LinkedList
 */
deleteLastNode();

/**
 Delete the list

 @memberOf LinkedList
 */
deleteList();