Genkit JS API reference
    Preparing search index...

    Function applyPatch

    • Applies an RFC 6902 JSON Patch to document, returning the new value.

      The input is not mutated; a clone is patched and returned. Operating on the root pointer ("") replaces / adds the whole document.

      Apply is intentionally lenient to keep streaming robust: applying an add / replace whose parent container is missing initializes the parent as an object, and a remove / replace targeting a missing member is a no-op rather than an error. test operations are honored and throw on mismatch.

      Type Parameters

      • T = any

      Parameters

      Returns T