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

fhf-linkedlist

v2.0.1

Published

The fhf-linkedlist library is a high-performance JavaScript implementation of a linked list, leveraging WebAssembly for efficient memory management and fast execution. It provides an easy-to-use API for common linked list operations such as appending, pus

Readme

Overview

fhf-linkedlist is a high-performance, WebAssembly-powered implementation of a Linked List data structure.
It blends JavaScript simplicity with native-speed operations through WASM, ideal for handling large or performance-critical data.

Table of Contents

  1. Installation
  2. Getting Started
  3. Class: LinkedList
  4. Memory Management
  5. WebAssembly Integration
  6. Examples
  7. License

Installation

Install via npm:

npm install fhf-linkedlist

Getting Started

A quick example to get you started:

import LinkedList from "fhf-linkedlist";

(async () => {
  const list = new LinkedList([1, 2, 3]);
  await list.append(4);
  list.display(); // Outputs: 1 -> 2 -> 3 -> 4
})();

Class: LinkedList

Core Methods

append(data)

Adds a new element to the end of the list.

await list.append(5);

push(data)

Adds a new element to the beginning of the list.

await list.push(0);

insert(index, data)

Inserts a new node at a specific position.

await list.insert(2, 99);

deleteNode(index)

Removes the node at the given index.

await list.deleteNode(1);

get(index)

Returns the value at the specified index.

const value = await list.get(2);

length()

Returns the total number of nodes in the list.

const len = await list.length();

reverse()

Reverses the entire list.

await list.reverse();

free()

Frees all memory associated with the list.

await list.free();

Utility Methods

display()

Prints the list to the console.

await list.display(); // e.g. 1 -> 2 -> 3

toArray()

Returns the list contents as a JavaScript array.

const arr = await list.toArray();

toString()

Returns a human-readable string representation.

const str = await list.toString();

indexOf(value)

Returns the index of the first occurrence of a value.

const idx = await list.indexOf(10);

find(predicate)

Returns the first value that matches a condition.

const found = await list.find((v) => v > 5);

findIndex(predicate)

Returns the index of the first element matching the predicate.

const idx = await list.findIndex((v) => v === 42);

includes(value)

Checks if a value exists in the list.

const hasValue = await list.includes(3);

clear()

Removes all nodes (same as free()).

await list.clear();

Iteration and Functional Methods

forEach(callback)

Executes a function for each value in the list.

await list.forEach((v) => console.log(v));

map(callback)

Applies a function to each element and returns a new array.

const doubled = await list.map((v) => v * 2);

filter(callback)

Filters values based on a condition and returns a new array.

const even = await list.filter((v) => v % 2 === 0);

some(callback)

Returns true if any value matches the condition.

const hasLarge = await list.some((v) => v > 10);

every(callback)

Returns true if all values satisfy the condition.

const allPositive = await list.every((v) => v > 0);

Advanced Operations

pop()

Removes and returns the last element.

const last = await list.pop();

shift()

Removes and returns the first element.

const first = await list.shift();

concat(otherList)

Appends another LinkedList to the current one.

await list.concat(otherList);

clone()

Creates a new LinkedList instance with the same elements.

const newList = await list.clone();

Memory Management

This library uses WebAssembly memory for efficient allocation, pointer manipulation, and node traversal. The memory is initialized with defined bounds and automatically expanded when needed for large datasets.


WebAssembly Integration

The linked list core (append, push, delete, reverse, etc.) is written in low-level C/C++ and compiled via Emscripten to WebAssembly. The JavaScript wrapper handles convenience methods and async synchronization with the WASM instance.


Examples

Appending & Displaying

import LinkedList from "fhf-linkedlist";

(async () => {
  const list = new LinkedList([1, 2]);
  await list.append(3);
  await list.push(0);
  list.display(); // Outputs: 0 -> 1 -> 2 -> 3
})();

Reversing & Filtering

const list = new LinkedList([1, 2, 3, 4]);
await list.reverse();
console.log(await list.toString()); // 4 -> 3 -> 2 -> 1
console.log(await list.filter((v) => v % 2 === 0)); // [4, 2]

Concatenation & Cloning

const list1 = new LinkedList([1, 2]);
const list2 = new LinkedList([3, 4]);
await list1.concat(list2);
list1.display(); // 1 -> 2 -> 3 -> 4

const copy = await list1.clone();
copy.display(); // 1 -> 2 -> 3 -> 4

License

MIT © 2025 — FHF Dev Team