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

js-linked-queue

v0.2.1

Published

A javascript implementation of the queue data structure with a doubly linked list

Readme

JS Linked Queue

Build Status CodeFactor Coverage Status

A queue data structure implemented as a dubly linked list with Typesctipt with support for generic types.

Changelog

  • 0.2.1
    • first method now return type T instead Node<T>

Installation

Install the package using a javascript package manager:

  1. Yarn
  > yarn add js-linked-queue
  1. Npm
  > npm install --save js-linked-queue

Usage

Using js-linked-queue is simple and can be used either with Javascript or Typescript.

Here an example with typescript

  import { Queue } from "js-linked-queue";

  // Because the queue supports generics you can 
  // put anything as a value for a queue node
  class Person {
    public name;
    public age;
    constructor(name, age) {
      this.name = name;
      this.age = age;
    }
  }

  // Create the queue
  const peopleQueue = new Queue<Person>();

  // To add people to queue use the enqueue function
  peopleQueue.enqueue(new Person("Mark", 23));
  peopleQueue.enqueue(new Person("Lucas", 43));

  // To delete an item from the head of the queue use dequeue
  peopleQueue.dequeue(); // reduce the queue size by one element

  // Use first() to get the head of the queue
  peopleQueue.first(); // Person { name: Lucas, age: 43}

  // You can even populate a queue from an existing object array
  const people: Person[] = [
    new Person("Alex", 23),
    new Person("Mary", 52),
    new Person("Alice", 19),
    new Person("Rita", 79),
    new Person("Frank", 57)
  ];

  const family = new Queue<Person>(people);

  // With a for-of loop you can iterate through the queue's elements:
  for(const relative of family) {
    console.log(`Hello, ${relative.name}`);
  }

Simple usage for javascript version of the example.


Api

Queue's apis.

  1. Queue<T>.constructor(input: T[] = [])
    The default queue constructor accept an array of generic type T that by default is set as an empty array
  2. instance.enqueue(item:T): boolean

    The enqueue method take an item of type T and return a boolean: true for correct enqueuing, false otherwise
  3. instance.dequeue(): T

    The dequeue method is used to remove an element from the head of the queue and returns the value T of the Node<T> deleted from the queue
  4. instance.first(): T

    The first method return the value of type T inside the head node of the queue
  5. instance.isEmpty(): boolean

    The isEmpty method return a boolean; true if the queue is empty otherwise false
  6. instance.size(): number

    The size method return the queue size as a number
  7. instance.clear(): void

    The clear method is used to completely delete the queue's elements
  8. [Symbol.iterator]

    Used for iterating though the queue's elements