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

@vobs/dict

v1.8.7

Published

Reactive business dictionary sources and SSR snapshots for Vobs.

Readme

@vobs/dict

Business dictionaries (value/label lists) with TTL caching, per-name request dedup, and revision-based race protection.

Install

npm install @vobs/dict

Quick start

import { createDict } from '@vobs/dict'

const dict = createDict({
  data: { user_status: [{ value: 'active', label: 'Active' }] },
  loader: async (name, signal) => {
    const response = await fetch(`/api/dicts/${name}`, { signal })
    return response.json()
  },
  staleTime: 60_000
})

dict.label('user_status', 'active') // 'Active'

const query = dict.query('roles')
await query.load()
query.items.value // [{ value, label, ... }]

API

| Signature | Description | | --- | --- | | createDict(options?: DictOptions): DictContext | Creates a dict context with optional static data, loader, staleTime (default 5 min), and onError. | | dict.data: Signal<DictData> | Reactive map of dict name to items. | | dict.loading: Signal<boolean> / dict.error: Signal<Error | null> | Global loading and error state. | | dict.get(name: DictName): DictItems | Current items, or an empty array when unknown. | | dict.find(name: DictName, value: DictValue): DictItem | undefined | Finds one item by value. | | dict.label(name: DictName, value: DictValue, fallback?): string | Label for a value; falls back to the given string, then String(value). | | dict.query(name: DictName): DictQuery | Per-name view with items, loading, error, updatedAt signals plus load() and invalidate(). | | dict.load(name: DictName, options?): Promise<DictItems> | Loads through the loader; skips while fresh unless { force: true }. | | dict.set(name: DictName, items: DictItems): void | Writes items directly and aborts any in-flight load. | | dict.invalidate(name?: DictName): void | Marks one or all dicts stale and aborts in-flight requests. | | dict.dehydrate() / dict.hydrate(snapshot) | Serializes and restores cached entries for SSR. | | dict.dispose(): void | Aborts requests and disposes all signals. | | dictPlugin(options?): VobsPlugin | Provides the context through DICT_KEY. | | useDict(): DictContext | Injects the dict context inside components. |

Loads are deduplicated per name, and every load carries a revision: invalidate() or set() aborts the in-flight request through the AbortSignal and a late response from a superseded request can never overwrite newer data. Failed loads keep the previous items and surface a DictError on query().error.

A failed load is not retried automatically: a plain load() after a failure returns the same failed promise again instead of issuing a new request. This is deliberate — a reactive consumer that reads query().error/loading and calls load() on change would otherwise re-request on every microtask turn and starve the event loop. Retry explicitly with load({ force: true }) or invalidate(name) first; set(), hydrate() and any successful load also clear the failure.

Types

DictName, DictValue, DictItem, DictItems, DictData, DictLoader, DictQuery, DictOptions, DictPluginOptions, DictContext, DictDehydratedEntry, DictDehydratedState, DictErrorCode