@wizard9/json-patch-apply
Version:
A library for describing, calculating, and applying patches to Javascript Objects.
43 lines (39 loc) • 1.46 kB
TypeScript
/**
This file is part of json-patch-apply.
json-patch-apply is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
json-patch-apply is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with json-patch-apply. If not, see <https://www.gnu.org/licenses/>.
*/
import { PatchOperation } from "./common";
export declare class PatchDiff {
diff(source: any, target: any): PatchOperation[];
private createOperation;
private diffAny;
private diffObject;
private getObjectKeys;
private diffPrimitive;
/**
* Recursively scans source creating micro patches to add each and every branch and leaf in the
* tree of data under the given object. This is needed because we cannot merge adds of large
* branches if they are an all or nothing operation.
*
* @param target
* @param path
* @param last
*/
private add;
/**
* Creates a remove for all values removed for auditing purposes
* @param source
* @param path
*/
private remove;
private replace;
}