File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " simple-diff" ,
3- "version" : " 1.6 .0" ,
3+ "version" : " 1.7 .0" ,
44 "description" : " simple diff for object and arrays with options" ,
55 "main" : " simple-diff.js" ,
6+ "types" : " simple-diff.d.ts" ,
67 "scripts" : {
78 "test" : " mocha -R spec"
89 },
Original file line number Diff line number Diff line change 1+ declare function diff ( oldObj : any , newObj : any , ops ?: DiffOptions ) : DiffEvent [ ] ;
2+
3+ export default diff ;
4+
5+ export interface DiffOptions extends Partial < PathChange > {
6+ idProp ?: string ,
7+ addEvent ?: string ,
8+ removeEvent ?: string ,
9+ changeEvent ?: string ,
10+ addItemEvent ?: string ,
11+ removeItemEvent ?: string ,
12+ moveItemEvent ?: string ,
13+ callback ?: ( event : DiffEvent ) => void ,
14+ comparators ?: Array < [ any , Comparator ] > ,
15+ ignore ?: Comparator ,
16+ }
17+
18+ export type Path = Array < string | number > ;
19+
20+ export interface PathChange {
21+ oldPath : Path ,
22+ newPath : Path ,
23+ }
24+
25+ export type Comparator = ( oldValue : any , newValue : any , options : PathChange ) => boolean ;
26+
27+ export interface DiffEvent extends PathChange {
28+ type : 'add' | 'remove' | 'change' | 'add-item' | 'remove-item' | 'move-item' ,
29+ oldValue : any ,
30+ newValue : any ,
31+ }
You can’t perform that action at this time.
0 commit comments