Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Function match

    • Pattern-match a result to a value with separate handlers for the two branches.

      const display = match(result, {
      ok: (v) => `loaded ${v.length} bytes`,
      err: (e) => `failed: ${e}`,
      });

      Type Parameters

      • T
      • E
      • R

      Parameters

      • r: Result<T, E>
      • handlers: { ok: (value: T) => R; err: (error: E) => R }

      Returns R