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

registrie

v1.0.0

Published

A flexible trie-based registry for storing and querying entries with optional hierarchical keys. `Registrie` supports both simple key-value stores and complex nested structures, making it a versatile tool for various applications.

Readme

RegisTrie

npm version License: MIT CI

A trie-based registry for TypeScript/JavaScript. Supports both simple key-value storage and hierarchical nested structures with prefix-based autocomplete.

Installation

npm install registrie

Usage

BasicRegistrie — simple key-value store

import { Registrie } from 'registrie';

const registry = Registrie<string>();

registry.register('apple', 'A tasty fruit');
registry.register('banana', 'A yellow fruit');
registry.register('apricot', 'An orange fruit');

registry.query('apple');       // 'A tasty fruit'
registry.query('cherry');      // undefined

registry.candidate('ap');      // ['apple', 'apricot']
registry.candidate('b');       // ['banana']
registry.candidate('');        // ['apple', 'apricot', 'banana']

registry.erase('apple');
registry.query('apple');       // undefined

NestedRegistrie — hierarchical store

Keys are extracted from the objects themselves. Children are registered recursively.

import { Registrie } from 'registrie';

interface Command {
  name: string;
  description: string;
  subCommands?: Command[];
}

const registry = Registrie<Command>('name', 'subCommands');

registry.register({
  name: 'git',
  description: 'Version control',
  subCommands: [
    { name: 'commit', description: 'Record changes' },
    { name: 'push',   description: 'Upload changes' },
  ]
});

registry.query('git');           // { name: 'git', ... }
registry.query('git commit');    // { name: 'commit', ... }
registry.query('git pull');      // undefined

// Pass a trailing space to get children of a node
registry.candidate('');          // ['git']
registry.candidate('git ');      // ['commit', 'push']

registry.erase('git');
registry.query('git');           // undefined
registry.query('git commit');    // undefined

API

Registrie<T>(entryKey?, childrenEntryKey?)

Factory function. Returns a BasicRegistrie<T> or NestedRegistrie<T> depending on arguments.

| Arguments | Returns | |-----------|---------| | none | BasicRegistrie<T> | | entryKey | NestedRegistrie<T> | | entryKey, childrenEntryKey | NestedRegistrie<T> with recursive children |

BasicRegistrie<T>

| Method | Signature | Description | |--------|-----------|-------------| | register | (key: string, value: T, frozen?: boolean) => void | Store an entry. Overwrites if key exists. Throws on empty key. | | query | (key: string) => T \| undefined | Exact key lookup. | | candidate | (key: string) => string[] | All keys with given prefix, sorted. | | erase | (key: string) => void | Remove an entry. No-op if not found. |

NestedRegistrie<T extends object>

| Method | Signature | Description | |--------|-----------|-------------| | register | (value: T, frozen?: boolean) => void | Store an entry, key extracted from object. Overwrites if key exists. | | query | (key: string) => T \| undefined | Space-delimited path lookup. | | candidate | (key: string) => string[] | Immediate child keys at current depth, sorted. Pass trailing space to get children. | | erase | (key: string) => void | Remove entry and its logical children. No-op if not found. |

Notes

frozen defaults to true By default, registered objects are frozen with Object.freeze() making them immutable after registration. Pass frozen: false to opt out:

registry.register('key', value, false);

Duplicate keys Registering the same key twice silently overwrites the previous entry.

candidate() in NestedRegistrie To get children of a node, include a trailing space in the key:

registry.candidate('git ');   // children of 'git' → ['commit', 'push']
registry.candidate('git');    // entries with prefix 'git' → ['git']

License

MIT © Higuma Soft