How dingff/match-kit works
Project type and purpose
• This is an open‑source, full‑stack library for JavaScript/TypeScript that provides a powerful pattern‑matching API.
• Under the hood it implements its core matching logic in Rust, compiles that to WebAssembly (WASM), and exposes a TypeScript/JavaScript facade for NPM consumers.
File structure
• Top‑level build and config files: Cargo.toml/Cargo.lock (Rust package), package.json/pnpm-lock.yaml (Node package), rslib.config.ts (TypeScript library bundler config), tsconfig.json.
• .husky, .npmrc, .release-it.json: Git hooks and release automation.
• src/
• lib.rs – Rust core implementation.
• wasm/
– match_kit.ts – glue code that loads/initializes the generated WASM.
• index.ts – TypeScript entry point that re‑exports match(), helpers, and types.
• types.ts – TS definitions and pattern helper interfaces.
• tests/
• web.rs – Rust unit/integration tests of the core matching engine.
README for additional insights
• Describes the library’s public API (match, any, not, regex, Some, None).
• Demonstrates the idea of compiling Rust → WASM and then using TypeScript wrappers.
• Emphasizes pattern‑matching priority and usage scenarios.