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

@bikky/smart-collections

v0.0.36

Published

SmartCollections

Downloads

153

Readme

SmartCollections

Features

Non-Collections:

OpenPromise extends Promise

A promise that has a resolve and reject function on it that can be called from outside the promise.

Expanded Collections:

SmartArray extends Array

A SmartArray is an array that has a few extra features:

  • remove(value) - remove an element by value.
  • removeAll(value) - remove all instances of a value.
  • peek() - get the first element without removing it.
  • look() - get the last element without removing it.
  • getRandom() - get a random element without removing it.
  • callEach(...args) - call each element in the array with the given arguments.

ArrayMap extends Map

A map where each value is stored in an array, provides shortcuts for common array operations on the values.

  • push(key, value)
  • remove(key, value)
  • removeAll(key, value)
  • includes(key, value)

SetMap extends Map

`A map where each value is stored in a set, provides shortcuts for common operations on the values.

  • push(key, value)
  • remove(key, value)
  • includes(key, value)

Chronological Collections

WaitableMap roughly implements Map

Keeps track of all get requests as pending promises which are resolved when the value is set.

ExpireMap implements Map

A map that expires values after a certain amount of time.

Provides events for when values are added or expires.

Weak Collections

WeakArray implements Array

An array whose values are weak so that they can be garbage collected if they're not held elsewhere. Automatically handles releasing their pointers as they are garbage collected.

Future: Provide events for when values are added or are garbage collected.

WeakRefMap implements Map

A map whose values are weak so that they can be garbage collected if they're not held elsewhere. Automatically handles releasing their pointers as they are garbage collected.

Called WeakRefMap because WeakMap is already taken but refers to when the keys are weak pointers, not the values.

Graph Collections

Map2D extends Map

Stores a two-dimensional map of keys and values. Contains the following bonus methods:

  • has2D(key, key, value) - looks up if the value exists in the 2D map
  • set2D(key, key, value) - sets the value in the 2D map
  • get2D(key, key, value) - retrieves the value in the 2D map

Treemap roughly implements Map

Treemap keeps track of keys and values as Nodes in a tree. Parent nodes can have multiple children, children may only have one parent.

Metadata Collections

VersionMap original

VersionMap keeps track of a tree of inheritance values allowing for values set in later versions to override the values of earlier versions.

Uses a TreeMap as a controller to create the hierarchy.

MetadataCache original

Stores metadata about a set of objects. Metadata is not stored on the object itself.

InheritableMetastore original

Stores metadata about a set of objects. The store is stored on on the object itself and can be inherited from parent objects.

Can be used on classes to have their values inherited onto the class' objects as well as child class' objects.

Also allows child classes to remove values on the parent class.