@adcp/sdk API Reference - v7.9.0
    Preparing search index...

    Function attachMatch

    • Attach a non-enumerable .match method to a TaskResult so callers can use the fluent form result.match({ completed: ..., failed: ... }).

      Non-enumerable so JSON.stringify(result), {...result}, and Object.keys(result) are unaffected — the method only surfaces through direct property access and autocomplete. Note: because the method is non-enumerable, shallow clones like const r = {...result} or structuredClone(result) do NOT carry the method over. Use the free function match(clone, handlers) on clones, or call attachMatch(clone) to re-decorate.

      Idempotent: if .match is already present, the result is returned unchanged. Safe to call on results that have already been decorated (e.g., a result forwarded through multiple client layers).

      Type Parameters

      • T

      Parameters

      Returns TaskResult<T>