Chained cold-path variant of matcher. Same chained API, no compile step, no cache — dispatches through matchWalk on every call. Use when you want the chained style but the rules truly change per call site.
import { P, matcherWalk } from "matchigo";function validate(value: unknown, max: number) { return matcherWalk<unknown, string>() .with(P.string, (s) => s.slice(0, max)) .with(P.number, (n) => String(Math.min(n, max))) .otherwise(() => "invalid") .run(value);} Copy
import { P, matcherWalk } from "matchigo";function validate(value: unknown, max: number) { return matcherWalk<unknown, string>() .with(P.string, (s) => s.slice(0, max)) .with(P.number, (n) => String(Math.min(n, max))) .otherwise(() => "invalid") .run(value);}
Chained cold-path variant of matcher. Same chained API, no compile step, no cache — dispatches through matchWalk on every call. Use when you want the chained style but the rules truly change per call site.