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

foldkit-metadata

v0.1.0

Published

Opaque typed metadata for Foldkit Plus: each interpreter owns a key, its merge, and its summary.

Readme

foldkit-metadata

Typed facts one package attaches to a value another package carries. The carrier merges them without knowing what they mean; only the package that declared a key can write or read its entries.

When to use it

Use it when you are writing a carrier (a description other packages decorate, such as a Surface Projection) or an interpreter (a package that decorates someone else's description, such as foldkit-remote recording the server data a selection needs).

Applications rarely import it. foldkit-surface re-exports Metadata, so an application that already uses Surface imports it from there.

It does not hold application state. Metadata describes a static declaration; it is not read from the Model and nothing dispatches a Message when it changes.

Mental model

interpreter              carrier                     interpreter / tooling
Key.of(value)  ──►  Metadata.combine(parts)  ──►  Key.get(metadata)
                    (each key's own merge)        Metadata.summarize(metadata)
  • The key owns the entry type, how duplicates merge, and how an entry is summarized as text.
  • The carrier owns where metadata lives and when parts are combined. It never inspects entries.
  • Lookup is by the key object, never its name, so two packages that pick the same name cannot read each other's entries.

Install

pnpm add foldkit-metadata

Example

import { Metadata } from 'foldkit-metadata'

// An interpreter declares its slot once, at module level.
const Flags = Metadata.key<string>('flags', {
  merge: flags => [...new Set(flags)],
  summarize: flag => flag,
})

// A carrier combines whatever its parts hold.
const combined = Metadata.combine([Flags.of('beta'), Flags.of('beta', 'gamma')])

Flags.get(combined) // ['beta', 'gamma']
Metadata.summarize(combined) // [{ name: 'flags', entries: ['beta', 'gamma'] }]

Flags.of and Metadata.combine only build values; nothing runs and nothing is registered globally. merge runs inside of and inside combine, so get always returns normalized entries.

API

| Call | Meaning | | --- | --- | | Metadata.key<A>(name, { merge, summarize }) | Declares a slot. Returns a key with of(...values) and get(metadata). | | Metadata.empty | The value with no entries. | | Metadata.combine(parts) | One value holding every part's entries, merged per key. | | Metadata.summarize(metadata) | Each key's entries as text, for tooling such as Module.toMarkdown. | | Metadata.is(value) | True only for a value this module made. |

Limits

  • Opaque and frozen. Only of and combine make a Metadata. A spread, a structuredClone, or a hand-built object with the brand has no entries: it reads as empty and combines as empty. Entry arrays are frozen.
  • Key identity is per module instance. Two copies of an interpreter (a duplicated install, a reloaded module) declare two keys and do not see each other's entries. Declare a key once, at module level.
  • Not serializable. summarize gives text for display; there is no decode path back to entries.