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

list-toolkit

v2.3.2

Published

Zero-dependency list-based data structures: linked lists (doubly/singly linked, circular), caches (LRU, LFU, FIFO), heaps, queues, stacks, splay trees.

Readme

List toolkit NPM version

Efficient list-based data structures for JavaScript. Pure ESM, zero dependencies, works in Node.js, Bun, Deno, and browsers.

Data structures included:

  • Linked lists — doubly and singly linked, circular. Node-based (link properties on your objects) or value-based (wraps values in nodes). Hosted (sentinel head) or headless (external pointer).
  • NT list converters — convert null-terminated lists to/from circular lists in place.
  • Heaps — min heap, leftist heap, skew heap.
  • Caches — LRU, LFU, FIFO, random eviction. Includes a decorator for functions, methods, and getters.
  • Queue and Stack — list-backed adapters.
  • Splay tree — self-adjusting binary search tree.
  • Utilities — push/append values, find, remove, validate, and more.

Works with your existing linked lists — no wrapper objects required.

  • Flexible, efficient, simple.
  • Zero dependencies, no surprises.
  • Pay only for what you use.
  • Usable as a foundation for other data structures.

Read all about the implemented ideas in the Backgrounder.

All lists share a consistent API: create from iterables, push/pop, insert/extract/remove, forward and reverse iterators, sort, reverse, and customizable link names.

Full documentation: wiki.

Installation

npm install list-toolkit

Introduction

See the wiki for full documentation. Quick examples below.

Value lists wrap arbitrary values:

import ValueList from 'list-toolkit/value-list.js';

const list = ValueList.from([1, 2, 3]);

// iterate over the list manually
for (let node = list.front; node !== list; node = node.next) {
  console.log(node.value); // 1, 2, 3
}

// iterate over the list with an iterator
for (const value of list) {
  console.log(value); // 1, 2, 3
}

// add more values:
list.pushBack(4);
list.pushFront(0);

console.log(list.popFront()); // 0
console.log(list.front.value); // 1

Lists can be made of arbitrary objects:

import List from 'list-toolkit/list.js';

class Person {
  constructor(name) {
    this.name = name;
  }
}

const john = new Person('John'),
  jane = new Person('Jane'),
  jim = new Person('Jim'),
  jill = new Person('Jill');

const people = List.from([john, jane, jim, jill]);

// iterate over the list manually:
for (let node = people.front; node !== people; node = node[people.nextName]) {
  console.log(node.name); // John, Jane, Jim, Jill
}
// yes, the link names are customizable, can be strings or symbols, for example:

const ladies = List.from([jane, jill], {nextName: 'n', prevName: 'p'});

// iterate over ladies
for (let node = ladies.front; node !== ladies; node = node.n) {
  console.log(node.name); // Jane, Jill
}

// let's move Jim to the front and John to the back:
people.moveToFront(jim);
people.moveToBack(john);

// sort the list
people.sort((a, b) => a.name.localeCompare(b.name) < 0);

for (const node of people) {
  console.log(node.name); // Jane, Jill, Jim, John
}

// let's extract all people from Jill to Jim
const ji = people.extractRange({from: jill, to: jim});
for (const node of people) console.log(node.name); // Jane, John
for (const node of ji) console.log(node.name); // Jill, Jim

// add them back:
people.append(ji);
for (const node of people.getReverseIterator()) {
  console.log(node.name); // Jim, Jill, John, Jane
}
ji.isEmpty === true;

// BTW, the list `ladies` is unchanged

License

BSD 3-Clause "New" or "Revised" License. See the LICENSE file for details.

Release History

  • 2.3.2 Updated dev dependencies.
  • 2.3.1 Bugfixes. Improved TS typing tests. Updated docs. Updated dev dependencies.
  • 2.3.0 Added TypeScript declarations for all modules. Added JSDoc. Removed CJS build. Bugfixes. Added missing methods.
  • 2.2.6 Updated dev dependencies.
  • 2.2.5 Updated dev dependencies.
  • 2.2.4 Updated dev dependencies.
  • 2.2.3 Updated dev dependencies.
  • 2.2.2 Updated dev dependencies.
  • 2.2.1 Technical release: updated deps, added more tests.
  • 2.2.0 Added leftist and skew heaps.
  • 2.1.1 Allowed functions to be used as nodes. Updated deps.
  • 2.1.0 Added splay tree. Updated deps.
  • 2.0.0 New major release.

For more info consult full release notes.