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)).
applyPatch<
T
>(
document: T,
patch: readonly Operation[],
validateOperation: boolean | Validator<T>,
mutateDocument: boolean = true,
banPrototypeModifications: boolean = true
): PatchResult<T>| Name | Type | Description |
|---|---|---|
document* | T | The document to patch |
patch* | readonly Operation[] | The patch to apply |
validateOperation | boolean | Validator<T> |
|
mutateDocument | boolean | Default: trueWhether to mutate the original document or clone it before applying |
banPrototypeModifications | boolean | Default: trueWhether to ban modifications to |