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

xtitan-list

v1.0.2

Published

This library provides implementations of essential data structures: Linked List (List), Queue, and Stack. Each is exported as a function-class for convenient use.

Downloads

142

Readme

Data Structures Library: List, Queue, and Stack

Read this in other languages: Русский

This library provides implementations of essential data structures: Linked List (List), Queue, and Stack. Each is exported as a function-class for convenient use.


Installation

First, install the library via NPM (if it's published) or clone the repository:

npm install xtitan-list

Usage

List

The List implements most of the methods of JavaScript arrays, making it easy and intuitive to use.

Supported Methods:

  • push(element): Adds an element to the end of the list.
  • pop(): Removes the last element and returns it.
  • unshift(element): Adds an element to the beginning of the list.
  • shift(): Removes the first element and returns it.
  • indexOf(element): Returns the index of the specified element (or -1 if not found).
  • splice(index, count, ...elements): Removes or adds elements at a specific index.
  • at(index): Returns the element at the specified index (similar to array.at()).
  • find({ element, callback }): Finds an element by value or via a callback function.
  • concat(collection): Merges the current list with another list or array.

Unimplemented Methods (in development):

  • sort(): Sorts the list.
  • reverse(): Reverses the list.
  • filter(callback): Filters the elements in the list.

Example:

import { List } from 'xtitan-list';

const list = new List();
list.push(1);
list.push(2);
list.push(3);

console.log(list.pop()); // 3
console.log(list.indexOf(2)); // 1

Queue

A Queue is a data structure that operates on the FIFO principle (First In, First Out).

Supported Methods:

  • enqueue(element) (alias for push): Adds an element to the end of the queue.
  • dequeue() (alias for shift): Removes the first element and returns it.
  • peek(): Returns the first element without removing it.

Example:

import { Queue } from 'xtitan-list';

const queue = new Queue();
queue.enqueue('A');
queue.enqueue('B');

console.log(queue.peek()); // 'A'
console.log(queue.dequeue()); // 'A'
console.log(queue.dequeue()); // 'B'

Stack

A Stack is a data structure that operates on the LIFO principle (Last In, First Out).

Supported Methods:

  • push(element) (alias for unshift): Adds an element to the beginning of the stack.
  • pop() (alias for shift): Removes the first element and returns it.
  • peek(): Returns the first element without removing it.

Example:

import { Stack } from 'xtitan-list';

const stack = new Stack();
stack.push('X');
stack.push('Y');

console.log(stack.peek()); // 'Y'
console.log(stack.pop()); // 'Y'
console.log(stack.pop()); // 'X'

Future Plans

  • Implementation of the sort, reverse, and filter methods for List.
  • Performance optimizations and addition of new features.

License

This project is licensed under the MIT License. See LICENSE for details.