alexreardon/tiny-invariant
A tiny invariant function observed · 2026-08-28
Health v2 · maintenance only
23/100
- Activity 0
- Release rhythm 8
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 3060
- days_rel: n/a
- days_push: 770
- n_releases_24m: 0
Adoption not part of the score
1863 stars · 48 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A tiny, zero-dependency invariant assertion function for JavaScript and TypeScript that throws when a condition is falsy. It also narrows types in TypeScript and Flow, making it useful for runtime checks and type safety.
Use cases
- assert a condition is truthy at runtime
- narrow nullable types in typescript
- replace the invariant package with a smaller alternative
- throw descriptive errors for invalid states
- validate function preconditions
When to avoid
- you need sprintf-style message formatting from the original invariant package
- you need rich assertion APIs like chai or expect
Facets
library · maturity stable
error-handling type-system developer-tools web-development programming-languages browser cross-platform assertion invariant type-guard typescript zero-dependency tiny nodejs
2 sources
- readme: https://github.com/alexreardon/tiny-invariant · fetched 2026-08-28 · a06e464581f1
- registry_npm: https://registry.npmjs.org/tiny-invariant · fetched 2026-08-29 · 4e88b78ae15b
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| alexreardon/tiny-invariant | main | 23 |
For agents
markdown · JSON · MCP: product_card(name="alexreardon/tiny-invariant")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem