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

@jrc03c/data-structures

v0.0.2

Published

a little library of data structures i made for educational porpoises 🐬

Readme

intro

a little library of data structures i made for educational porpoises 🐬

installation

npm install --save @jrc03c/data-structures

usage

import { LinkedList } from "@jrc03c/data-structures"

const x = new LinkedList([1, 1, 2, 3, 5, 8, 13])
x.push(21)
x.push(34, 55, 89)
console.log(x.toArray())
// [
//    1,  1,  2,  3,  5,
//    8, 13, 21, 34, 55,
//   89
// ]

api

LinkedList

in general, the LinkedList class uses the same api as Array but with a few small exceptions:

  1. the constructor only accepts an array of values (or nothing at all). in other words, it does not accept a length like the Array constructor does.
  2. the class has get and set instance methods.
  3. the class does not have the static methods fromAsync and of.
  4. the class does not have the instance methods copyWithin, fill, flat, and flatMap.
  5. in places where Array methods return Array instances (e.g., filter), the LinkedList methods return LinkedList instances.
  6. in places where Array methods accept Array instances as arguments (e.g., concat), the LinkedList methods accept both Array instances and LinkedList instances.

LinkedList(x) (constructor)

optionally accepts an array of values with which to populate the list.

properties

length (getter)

returns the length of the list. is read-only.

methods

get(i)

returns the value at index i.

set(i, v)

sets the value at index i to be v.

examples

import { LinkedList } from "@jrc03c/data-structures"

const x = new LinkedList([2, 3, 4])
x.push("foo")
x.push(true, false)
console.log(x.toArray())
// [ 2, 3, 4, 'foo', true, false ]

const y = x.slice(1, 4)
console.log(y)
// LinkedList {}
console.log(y.toArray())
// [ 3, 4, 'foo' ]

y.splice(1, 1, "bar")
console.log(y.toArray())
// [ 3, 'bar', 'foo' ]

const z = x.concat([Infinity, NaN])
console.log(z.toArray())
// [ 2, 3, 4, 'foo', true, false, Infinity, NaN ]

for (const value of z) {
  console.log(value)
}
// 2
// 3
// 4
// 'foo'
// true
// false
// Infinity
// NaN

const chars = new LinkedList(["a", "b", "c", "d", "e"])
console.log(chars.join(":"))
// 'a:b:c:d:e'

const fibs = new LinkedList([1, 1, 2, 3, 5, 8, 13])
console.log(fibs.reduce((a, b) => a + b))
// 33

fibs.sort((a, b) => b - a)
console.log(fibs.toArray())
// [
//   13, 8, 5, 3,
//    2, 1, 1
// ]