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

@velrim/scoring

v0.1.0

Published

Velrim scoring/matching math (per-field P/R/F1, ECE, AUROC, Brier, risk-coverage) over the 3-state golden format. Pure TS, ESM, zero runtime deps. The same code velrim-eval and the published reliability curves run.

Readme

@velrim/scoring

The scoring and matching math behind velrim-eval and Velrim's published reliability curves. Pure, deterministic, zero-runtime-dependency TypeScript over the 3-state golden format (present / null / missing):

  • per-field precision / recall / F1 (3-state confusion cells that score fabrication and omission distinctly)
  • Expected Calibration Error (ECE) over 15 equal-mass bins
  • Brier score
  • AUROC (rank-sum / Mann–Whitney U, average-rank tie handling)
  • the risk–coverage (selective-prediction) curve
  • scoreAgainstGolden(pred, gold) — the single entry point that integrates all of the above

This package exists so the math lives once. The Velrim API, the velrim-eval CLI, and the published reliability curves all run this same code — when you re-score a golden set locally, there is no second implementation to drift from.

Usage

import { scoreAgainstGolden, type GoldenDoc, type ScoringField } from '@velrim/scoring';

const gold: GoldenDoc = {
  docClass: 'invoice',
  fields: { '/total': { state: 'present', value: 1240.5 }, '/discount': { state: 'null' } },
};
const pred: Record<string, ScoringField> = {
  '/total': { state: 'present', value: 1240.5, confidence: 0.91 },
  '/discount': { state: 'null' },
};

const { perField, ece, auroc, riskCoverage } = scoreAgainstGolden(pred, gold);

ScoringField is structural — { state; value?; confidence? } — so any extraction output that carries a state and a confidence scores directly, no wrapper and no cast.

Matching semantics (0.1.0 amendments)

Two amendments landed in 0.1.0, pre-registered and applied identically to every system scored with this code (see CHANGELOG.md for the full rationale):

  • Absent-equivalence (FD-8). For the correctness label, a predicted null or missing matches a golden null or missing: an explicit-null abstention is not penalized against an omitted-key golden, or vice versa. A golden present still requires a predicted present plus a value match. Per-field P/R/F1 cells were already keyed on present vs not-present and are unchanged.
  • Value normalization (FD-10). normalizeValue(value, kind) with kind: 'currency' | 'date' | 'text' normalizes both sides of a value match: currency to a canonical minimal decimal string ("$1,880.00" → "1880"), dates to ISO-8601 YYYY-MM-DD (slash dates read in US MM/DD order, a pre-registered rule; two-digit years <50 → 20xx, else 19xx), text to trimmed/whitespace-collapsed/lowercased form. Unparseable currency/date values fall back to text folding. Strict matching stays the default: only leaves listed in options.normalizers normalize.
// Strict column (unchanged default) vs normalized column (per-leaf opt-in):
const strict = scoreAgainstGolden(pred, gold);
const normalized = scoreAgainstGolden(pred, gold, {
  normalizers: { '/total': 'currency', '/date': 'date', '/vendor': 'text' },
});

The per-field pointer→kind tables are not part of this package; evaluations freeze them in their published analysis plans and pass them in.

ESM-only, "type": "module", Node ≥ 20.