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

abstract-linked-lists

v1.1.0

Published

A TypeScript library that provides implementations of singly and doubly linked lists, designed to support both object-oriented and functional programming paradigms.

Readme

Abstract Linked Lists

NPM Version Coverage Status

A TypeScript library that provides implementations of singly and doubly linked lists, designed to support both object-oriented and functional programming paradigms.

Key Features

  • 🔧 Dual Programming Support: Facilitates both object-oriented and functional programming approaches, allowing developers to choose the style that best fits their project requirements.

  • 🔒 Type Safety: Utilizes Typescript generics and strict typing to ensure type correctness and reduce runtime errors.

  • Performance Optimization: Implements efficient memory usage and optimized operations to enhance performance.

  • 📐 Modular Architecture: Enables tree-shakeable imports, allowing developers to include only the necessary modules and minimize bundle size.

  • 🏗️ Extensibility: Provides abstract base classes and interfaces that can be extended to create custom linked list implementations tailored to specific needs.

Table of Contents

System Requirements

| Package | Version | | ----------- | ---------- | | Node.js | ≥ 18.0.0 | | npm | ≥ 8.0.0 |

Installation

Install via npm

npm install abstract-linked-lists

Install via yarn

yarn add abstract-linked-lists

Install via pnpm

pnpm install abstract-linked-lists

Getting Started

Here's a quick guide to help you get started with the library.

Using Class-Based Implementation

import { SinglyLinkedList, SinglyLinkedListNode } from 'abstract-linked-lists';

// Create a new list
const list = new SinglyLinkedList();

// Create node instances
const node_a = new SinglyLinkedListNode();
const node_b = new SinglyLinkedListNode();

// Add nodes to the list
list.pushNode(node_a);
list.pushNode(node_b);

// Iterate over list nodes
for (const node of list) {
  console.log(node);
}

Using Functional Implementation

import { singlyLinkedList } from 'abstract-linked-lists';

const { create: createNode } = singlyLinkedList.node;
const { create: createList, pushNode } = singlyLinkedList.list;
const { inOrder } = singlyLinkedList.iterators;

// Create a new list
const list = createList();

// Create node instances
const node_a = createNode();
const node_b = createNode();

// Add nodes to the list
pushNode(list, node_a);
pushNode(list, node_b);

// Iterate over list nodes
for (const node of inOrder(list.head)) {
  console.log(node);
}

Importing Modules

The library offers flexible import options to suit different development needs. You can import everything at once, focus on specific list types, or select individual functions as needed.

Importing the Entire Package

To access all classes, interfaces, and functional APIs:

import {
  // Concrete Classes
  SinglyLinkedList,
  SinglyLinkedListNode,
  DoublyLinkedList,
  DoublyLinkedListNode,

  // Abstract Base Classes
  AbstractLinkedList,
  AbstractSinglyLinkedList,
  AbstractSinglyLinkedListNode,
  AbstractDoublyLinkedList,
  AbstractDoublyLinkedListNode,

  // Interfaces
  ILinkedList,
  ISinglyLinkedList,
  ISinglyLinkedListNode,
  IDoublyLinkedList,
  IDoublyLinkedListNode,

  // Functional APIs
  singlyLinkedList,
  doublyLinkedList,
} from 'abstract-linked-lists';

This approach is convenient when you need a broad range of functionalities from the library.

Importing Specific List Types

If you're working with a particular type of linked list, you can import related modules directly.

For Singly Linked List

import {
  node,
  list,
  iterators,
} from 'abstract-linked-lists/singly-linked-list';

For Doubly Linked List

import {
  node,
  list,
  iterators,
} from 'abstract-linked-lists/doubly-linked-list';

This method helps keep your bundle size small by only including necessary modules.

Importing Individual Functions

For maximum control and minimal footprint, import individual functions or operations.

Singly Linked List Functions

// Node operations
import {
  create as createNode,
  detach,
} from 'abstract-linked-lists/singly-linked-list/node';

// List operations
import {
  create as createList,
  clear,
  nodeAt,
  popNode,
  pushNode,
  shiftNode,
  unshiftNode,
} from 'abstract-linked-lists/singly-linked-list/list';

// Iterators
import {
  inOrder,
  inReverseOrder,
} from 'abstract-linked-lists/singly-linked-list/iterators';

Doubly Linked List Functions

// Node operations
import {
  create as createNode,
  detach,
} from 'abstract-linked-lists/doubly-linked-list/node';

// List operations
import {
  create as createList,
  clear,
  nodeAt,
  popNode,
  pushNode,
  shiftNode,
  unshiftNode,
} from 'abstract-linked-lists/doubly-linked-list/list';

// Iterators
import {
  inOrder,
  inReverseOrder,
} from 'abstract-linked-lists/doubly-linked-list/iterators';

By importing only what you need, you optimize performance and maintain a clean codebase.

Code documentation

The complete API reference of the library is available at the code documentation site.

Issues and Support

If you encounter any issues or have questions, please open an issue.

License

This project is licensed under the MIT License.