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

@supercat1337/dictionary

v1.0.0

Published

A simple data structure that maps keys to arrays of values, enabling efficient storage and retrieval of multiple values per key.

Readme

Dictionary

A simple data structure that maps keys to arrays of values, enabling efficient storage and retrieval of multiple values per key.

Installation

You can install the package via npm: npm install @supercat1337/dictionary

Usage

Here is an example usage of the Dictionary class:

import { Dictionary } from '@supercat1337/dictionary';

const dictionary = new Dictionary();
dictionary.add('key', 'value');
dictionary.add('key', 'value2');
// same as dictionary.add('key', 'value', 'value2');

dictionary.add('key2', 'value3');

console.log(dictionary.getLastValue('key')); // 'value2'
console.log(dictionary.get('key')); // ['value', 'value2']
console.log(dictionary.keys()); // ['key', 'key2']
console.log(dictionary.size); // 2

dictionary.clear('key');
console.log(dictionary.get('key')); // []

dictionary.remove('key');
console.log(dictionary.get('key')); // undefined

dictionary.removeAll();
console.log(dictionary.size); // 0

dictionary.add('key', 'value', 'value2');
dictionary.add('key2', 'value3');

dictionary.iterateAll((key, value) => {
    console.log(key, value);
});
// "key", "value"
// "key", "value2"
// "key2", "value3"

Properties

size

The number of keys in the dictionary.

Methods

add(key, value)

Adds a value to a key in the dictionary. If the key is not in the dictionary, it will be added.

get(key)

Returns the values associated with a key in the dictionary. If the key is not in the dictionary, it will return an empty array.

getLastValue(key)

Returns the last value associated with a key in the dictionary. If the key is not in the dictionary, it will return undefined.

exists(key)

Checks if a key exists in the dictionary.

clear(key)

Clears the values associated with the given key in the dictionary, setting it to an empty array.

remove(key)

Removes a key and its associated values from the dictionary.

removeAll(key)

Removes all keys and their associated values from the dictionary.

keys()

Returns an array of keys in the dictionary.

iterateAll(callback)

Calls the given callback function for each value in the dictionary.

iterate(callback)

Calls the given callback function for each value associated with a key in the dictionary.

License

MIT