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

seqnext-map

v0.0.1

Published

A Map implmentation

Downloads

4

Readme

seqnext-map - Map that supports seqnext

Map

In ES6 and beyond, you have this type:

// ES standard
// my forEach doesn't include thisArg as it seems generally silly
interface Map<K, V> {
  clear(): void;
  delete(key: K): boolean;
  // forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
  forEach(cb: (value: V, key: K) => void): void;
  get(key: K): V | undefined;
  has(key: K): boolean;
  set(key: K, value: V): Map<K, V>; // this;
  readonly size: number;
}

I needed that type, but I was ES5. Also, I wanted direct control over the storage and access.

The map here offers

interface SeqNextMap<K, V> extends Map<K, V> {
  toSeq(): Seq<[K, V]>;
}

Here we offer the ablity to specificy a comparison function

createMap<K,V>(comparer?: (a: K, b: K) => number, items?: [K, V][]): SeqNextMap<K, V>;

If no comparer is provided, we'll just make K a string and go from there.

This map uses a tree.

Tree

If you ever take a computer science data structures course, you'll learn to love or hate all kinds of abstract trees.

You needn't know how they're done, you need only know that they are the best way to store and retrieve ordered data.

When I loaded a few thousands attributes into a Javascript object and it cried for mercy before crashing horribly, I knew I needed something more specific than what is essentially a hack. And, since I know I want unique keys, a structure that allowed for the most efficient accesss made sense. I found a few implmentations, but none were quite right. So, here's another.

interface Tree<T> {
  readonly isEmpty: boolean;
  get(value: T): T | undefined;
  set(value: T): Tree<T>;
  has(value: T): boolean;
  delete(value: T): boolean;
  clear(): void;
  toSeq(): Seq<T>;
}

createTree<T>(comparer?: (a: T, b: T) => number, items?: T[);

Currently, that tree just is a brain dead binary tree; no balance. Self balancing is to come.

seqnext

This comes from another library. Indeed, it was the tree itself that lead to the seqnext, as I wanted a lazy way to iterate over the structure if needed. A sequence paradigm is even more useful than the tree, so it gets top billing.

Test Code

Coming soon

Licence

MIT