📝 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

+3
View File
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
- restore the README's Synopsis and Examples sections: a quick-start recipe plus
real-world examples (primitive-union dispatch, a fallback, a property union
narrowed by the tagged-union matcher, and a widening variant)
- document the public API in the README: the four factories, when to use each,
what the `W` (widening) suffix means, and examples that bind the handler-map
function once