datum-merge
Version:
Simplified diff and merging for deeply nested objects
23 lines • 1.08 kB
TypeScript
import { Diff } from "./diff-lib/deep-diff";
export type PatchResult<T = any> = {
path: string;
op: "add" | "remove" | "replace" | "test";
value?: Readonly<T>;
prev?: any;
};
export declare function diffToPatchLog(differences: readonly Diff<any, any>[], storePrev?: boolean): PatchResult[];
export declare function deepPatchLog(lhsObj: {
[key: string]: any;
}, rhsObj: {
[key: string]: any;
}, orderInd?: boolean, storePrev?: boolean): PatchResult[];
export declare function applyPatchLog(patchLog: PatchResult[], target: object): boolean;
export declare function revertPatchLog(patchLog: PatchResult[], target: object): boolean;
export declare function forcePatchLog(patchLog: {
path: string;
value?: unknown;
}[], target?: object): void;
export declare function immutablePatch(target: object, patchSrc: PatchResult[], patchDir?: "apply" | "revert" | "force"): object;
export declare function asLodashPath(pointer: string): string[];
export declare function getPointerValue(document: any, pointer: string): any;
//# sourceMappingURL=patch-low.d.ts.map