📝 Restore and rewrite the README entry point

The README collapsed to API-only prose once the old match/P surface was
dropped. Rebuild its entry-point shape: a quick-start Synopsis walked through
a Contact union, a dedicated Installation section, and a real-world Examples
section (primitive-union dispatch, a fallback, a property union narrowed by
the tagged-union matcher, and the widening variant).

Set the tagline and Description to the library's identity — exhaustive,
type-safe pattern matching for TypeScript — and state the goal Moose-style:
type-safe pattern matching with a lean syntax, accomplished by exhaustive
branches and typed per-branch handler parameters, backed by autocomplete and
a tiny footprint. Drop the F#-style framing and the stale "matches method is
a type guard" and "(not regex)" copy from the README, AGENTS.md and the
package.json description. Every fence is a doc-test, so the examples cannot
drift from the API.
This commit is contained in:
tmu committed 2026-09-24 21:55:51 +00:00
1 parent 28d87b3387
commit 8261759190
5 files changed
+146 -11

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "tiny-pattern-ts",
"version": "0.8.1",
"description": "Pattern matching for TypeScript/ESM environments (F#-style, not regex)",
"description": "Exhaustive, type-safe pattern matching for TypeScript",
"keywords": [
"adt",
"algebraic-data-types",