• Apply a full JSON Patch array on a JSON document. Returns the {newDocument, result} of the patch. It modifies the document object and patch - it gets the values by reference. If you would like to avoid touching your values, clone them: jsonpatch.applyPatch(document, jsonpatch._deepClone(patch)).

    Type Parameters

    • T

    Parameters

    • document: T

      The document to patch

    • patch: readonly Operation[]

      The patch to apply

    • OptionalvalidateOperation: boolean | Validator<T>

      false is without validation, true to use default jsonpatch's validation, or you can pass a validateOperation callback to be used for validation.

    • mutateDocument: boolean = true

      Whether to mutate the original document or clone it before applying

    • banPrototypeModifications: boolean = true

      Whether to ban modifications to __proto__, defaults to true.

    Returns PatchResult<T>

    An array of {newDocument, result} after the patch