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

@dandre3000/list

v0.1.3

Published

A double linked list class with an API similar to the Array class and a corresponding list node class.

Downloads

5

Readme

list

Exports a List class that represents a double linked list with an API based on the Array class, and a ListNode class that represents a node that may be contained in a List.

Installation

npm install @dandre3000/list

Usage

import { List, ListNode } from '@dandre3000/list'

// Add values
const list = new List(1, 2, 3)
list.push(4, 5)
list.unshift(0)

// Remove values
list.pop()
list.shift()

// Iterate values
for (const node of list) {
  console.log(node.value) // 1, 2, 3, 4
}

// Access nodes
const firstNode = list.first
const lastNode = list.last
const nodeAt2 = list.at(2)

// Node operations
console.log(nodeAt2 === lastNode.previous) // true
new ListNode(6).appendTo(lastNode)

// Iterative methods
list.filter(({ value }) => value & 1 ^ 1)
.map(({ value }) => value * 2)

// Conversion methods
list.nodes()
list.values()
console.log(list.toString()) // 2,6

API

Click here to view full type definitions

ListNode

Instance Properties

  • value: T
    • The value stored in the node
  • list: List<T> | null
    • The list containing this node or null if not in a list
  • previous: ListNode<T> | null
    • The previous node in the list or null
  • next: ListNode<T> | null
    • The next node in the list or null

Instance Methods

  • constructor(value: T)
    • Creates a ListNode instance with the given value
  • constructor(value: T, list: List<T>, index: number)
    • Creates a ListNode and inserts it into the given list at the specified index
  • prependTo(node: ListNode<T>): this
    • Removes this node from its list and prepends it to another node
  • appendTo(node: ListNode<T>): this
    • Removes this node and appends it to another node
  • insertInto(list: List<T>, index: number): this
    • Removes this node and inserts it into another list at the specified index
  • remove(): this
    • Removes this node from its containing list

List

Static Methods

  • from<T>(items: Iterable<T>): List<T>
    • Creates a List instance from an iterable
  • from<T, U>(items: Iterable<T>, mapFn: (element: T, index: number) => U, self: any): List<U>
    • Creates a List instance with the mapped values of an iterable
  • fromAsync<T>(items: Iterable<T> | AsyncIterable<T>): List<T>
    • Asynchronously creates a List instance from an iterable
  • fromAsync<T, U>(items: Iterable<T> | AsyncIterable<T>, mapFn: (element: T, index: number) => U, self: any): List<U>
    • Asynchronously creates a List instance with the mapped values of an iterable

Instance Properties

  • first: ListNode<T>
    • The first node or null if empty
  • last: ListNode<T>
    • The last node or null if empty
  • length: number
    • The length of the list

Instance Methods

  • constructor(length: number)
    • Creates a List with specified length, values are undefined
  • constructor(...values: T[])
    • Creates a List and inserts the given values
  • at(index: number): ListNode<T> | null
    • Returns the node at the given index or null if index is out of bounds
  • unshift(...values: T[]): number
    • Adds values to the front and returns new length
  • push(...values: T[]): number
    • Adds values to the end and returns new length
  • insert(index: number, ...values: T[]): number
    • Inserts values at the specified index and returns new length
  • shift(): ListNode<T>
    • Removes the first node and return it or null if empty
  • pop(): ListNode<T>
    • Removes the last node and return it or null if empty
  • remove(index: number): ListNode<T>
    • Removes and returns node at index
  • clear(): this
    • Removes all nodes
  • splice(start: number, end: number): List<T>
    • Moves a range of nodes into a new list
  • splice(start: number, end: number, list: List<T>, index: number): List<T>
    • Moves a range of nodes into another list at index
  • fill(value: T): this
    • Sets all node values to the given value
  • reverse(): this
    • Reverses the list order
  • copyWithin(start: number, end: number, target: number, targetEnd?: boolean): this
    • Copies values within list ranges
  • sort(callback): this
    • Sorts values in the list
  • flat(depth?: number): this
    • Concatenate nested list values into the list
  • slice(start?: number, end?: number): List<T>
    • Returns a copy of a portion of the list
  • includes(value: T, backwards?: boolean): boolean
    • Returns true if value is contained in the list
  • indexOf(value: T, backwards?: boolean): number
    • Returns the index of the value or -1
  • find(callback, self?, backwards?): ListNode<T>
    • Finds the first node where callback returns true
  • findIndex(callback, self?, backwards?): number
    • Finds the index of the first node where callback returns true
  • some(callback, self?, backwards?): boolean
    • Returns true if any node matches callback
  • every(callback, self?, backwards?): boolean
    • Returns true if all nodes match callback
  • reduce(callback, initialValue, self?, backwards?): U
    • Reduces nodes using callback
  • filter(callback, self?, backwards?): this
    • Removes nodes where callback returns true
  • map(callback, self?, backwards?): List<U>
    • Maps nodes to new values in place
  • forEach(callback, self?, backwards?): this
    • Calls callback for each node
  • concat(...values: (T | List<T>)[]): List<T>
    • Returns a new List with the given values appended
  • nodes(): ListNode<T>[]
    • Returns Array of all nodes
  • values(): T[]
    • Returns Array of all node values
  • toString(): string
    • String representation of the list
  • [Symbol.iterator](): Iterator<T>
    • Iterable protocol for the list

License

MIT