matchigo - v1.0.2
    Preparing search index...

    Function matcherWalk

    • 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.

      Type Parameters

      • T
      • R

      Returns Matcher<T, R, T>

      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);
      }