mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Type definitions for 'deep-diff', a library that supports diffing JavaScript objects
This commit is contained in:
42
deep-diff/deep-diff.d.ts
vendored
Normal file
42
deep-diff/deep-diff.d.ts
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// Type definitions for deep-diff
|
||||
// Project: https://github.com/flitbit/diff/
|
||||
// Definitions by: ZauberNerd <https://github.com/ZauberNerd/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
interface IDiff {
|
||||
kind: string;
|
||||
path: string[];
|
||||
lhs: any;
|
||||
rhs: any;
|
||||
index?: number;
|
||||
item?: IDiff;
|
||||
}
|
||||
|
||||
interface IAccumulator {
|
||||
push(diff: IDiff): void;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface IPrefilter {
|
||||
(path: string[], key: string): boolean;
|
||||
}
|
||||
|
||||
declare module deepDiff {
|
||||
export interface IDeepDiff {
|
||||
diff(): IDiff;
|
||||
diff(lhs: Object, rhs: Object, prefilter?: IPrefilter, acc?: IAccumulator): IDiff[];
|
||||
observableDiff(lhs: Object, rhs: Object, changes: Function, prefilter?: IPrefilter, path?: string[], key?: string, stack?: Object[]): void;
|
||||
applyDiff(target: Object, source: Object, filter: Function): void;
|
||||
applyChange(target: Object, source: Object, change: IDiff): void;
|
||||
revertChange(target: Object, source: Object, change: IDiff): void;
|
||||
isConflict(): boolean;
|
||||
noConflict(): IDeepDiff;
|
||||
}
|
||||
}
|
||||
|
||||
declare var diff: deepDiff.IDeepDiff;
|
||||
|
||||
declare module "deep-diff" {
|
||||
export = diff;
|
||||
}
|
||||
Reference in New Issue
Block a user