@xemahq/registry
v0.1.7
Published
Generic key-indexed registry data structure with fail-fast duplicate/missing-key errors. Zero runtime dependencies. Used by every Kernel package that needs a typed lookup table.
Readme
@xemahq/registry
Typed key-indexed registry with fail-fast lookups.
Overview
A small generic registry: a typed lookup table keyed by string. Registering a duplicate key throws, and require throws on a missing key instead of returning undefined. No runtime dependencies.
When to use it
- You need an in-memory, strongly typed lookup table whose duplicate and missing-key cases must fail loudly.
Installation
pnpm add @xemahq/registryUsage
import { Registry } from '@xemahq/registry';
const registry = new Registry<string, { key: string; label: string }>({
name: 'labels',
});
registry.register({ key: 'alpha', label: 'Alpha' });
const entry = registry.require('alpha'); // throws if absent
const all = registry.list();License
Apache-2.0 © Xema — xema.dev
