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

singly-linked-list-utils

v1.0.0

Published

A lightweight JavaScript library for Singly Linked Lists

Readme

SSL Utils

A lightweight, beginner-friendly JavaScript library for working with Singly Linked Lists.

The goal of this project is to provide an easy-to-use implementation of a singly linked list with common operations while keeping the API simple and intuitive.


✨ Features

Current version supports:

  • ✅ Create a linked list from an array
  • ✅ Convert linked list to an array
  • ✅ Insert at front
  • ✅ Insert at back
  • ✅ Insert at any index
  • ✅ Delete front node
  • ✅ Delete last node
  • ✅ Delete node at an index
  • ✅ Delete first occurrence of a value
  • ✅ Delete all occurrences of a value
  • ✅ Delete the entire linked list
  • ✅ Print linked list
  • ✅ Convert linked list to string
  • ✅ Get length of linked list

Upcoming features:

  • ⬜ Reverse
  • ⬜ Find
  • ⬜ Middle
  • ⬜ Sort

Installation

npm install ssl-utils

Usage

const { SinglyLinkedList } = require("ssl-utils");

Create a list from an array.

const list = SinglyLinkedList.from([10, 20, 30]);

console.log(list.toArray());
// [10, 20, 30]

API

Create

SinglyLinkedList.from(array)

Creates a new linked list from an array.

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

Insert

insertFront(value)

Insert a node at the beginning.

list.insertFront(5);

Before

10 -> 20 -> 30

After

5 -> 10 -> 20 -> 30

insertBack(value)

Insert at the end.

list.insertBack(40);

Before

10 -> 20 -> 30

After

10 -> 20 -> 30 -> 40

insertAt(value, index)

Insert at any valid index.

list.insertAt(25, 2);

Before

10 -> 20 -> 30

After

10 -> 20 -> 25 -> 30

Delete

deleteFront()

Deletes the first node.

list.deleteFront();

deleteBack()

Deletes the last node.

list.deleteBack();

deleteAt(index)

Deletes node at the given index.

list.deleteAt(2);

deleteValue(value)

Deletes the first occurrence of the given value.

list.deleteValue(20);

Example

Before

10 -> 20 -> 30 -> 20

After

10 -> 30 -> 20

deleteAllValues(value)

Deletes all occurrences of a value.

list.deleteAllValues(20);

Before

10 -> 20 -> 30 -> 20

After

10 -> 30

deleteList()

Deletes the entire linked list.

list.deleteList();

Conversion

toArray()

Returns an array representation.

list.toArray();

Output

[10, 20, 30]

toString()

Returns a printable string.

list.toString();

Output

10 -> 20 -> 30

print()

Prints the linked list.

list.print();

Output

10 -> 20 -> 30

Length

length()

Returns the number of nodes.

console.log(list.length());

Output

3

Example

const { SinglyLinkedList } = require("ssl-utils");

const list = SinglyLinkedList.from([10, 20, 30]);

list
    .insertFront(5)
    .insertBack(40)
    .insertAt(25, 3);

console.log(list.toString());

list.deleteFront();
list.deleteBack();
list.deleteValue(25);

console.log(list.toArray());

console.log(list.length());

Output

5 -> 10 -> 20 -> 25 -> 30 -> 40

[10, 20, 30]

3

Error Handling

The library throws descriptive errors for invalid operations.

Examples:

  • Input must be an array
  • Value cannot be null or undefined
  • Index must be a non-negative integer
  • Index must be a non-negative integer and less than size
  • List is empty
  • Value not found in the list

Supported Data Types

The linked list can store any JavaScript value, including:

  • Integers
  • Floating-point numbers
  • Strings
  • Booleans
  • Objects
  • Arrays
  • Functions
  • Custom classes

Example

const list = SinglyLinkedList.from([
    1,
    3.14,
    "SSL Utils",
    true,
    { id: 1 }
]);

Testing

The project uses Jest for unit testing.

Run all tests:

npm test

Run tests with verbose output:

npm test -- --verbose

Project Structure

ssl-utils
│
├── src
│   ├── Node.js
│   ├── SinglyLinkedList.js
│   └── index.js
│
├── tests
│
├── examples
│
├── README.md
├── LICENSE
├── package.json
└── .gitignore

Contributing

Contributions, feature requests, bug reports, and improvements are welcome.

Feel free to fork the repository and submit a pull request.


License

This project is licensed under the MIT License.


Roadmap

Version 1.0.0

  • ✅ Create from array
  • ✅ Insert operations
  • ✅ Delete operations
  • ✅ Conversion utilities
  • ✅ Length
  • ✅ Print

Planned

  • ⬜ Reverse
  • ⬜ Find
  • ⬜ Middle
  • ⬜ Sort
  • ⬜ Doubly Linked List support