File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export default function diff(
25
25
! richTypes [ Object . getPrototypeOf ( obj [ key ] ) . constructor . name ] &&
26
26
! stack . includes ( obj [ key ] )
27
27
) {
28
- const nestedDiffs = diff ( obj [ key ] , newObj [ key ] , stack . concat ( obj [ key ] ) ) ;
28
+ const nestedDiffs = diff ( obj [ key ] , newObj [ key ] , stack . concat ( [ obj [ key ] ] ) ) ;
29
29
diffs . push (
30
30
...nestedDiffs . map ( ( difference ) => {
31
31
difference . path . unshift ( key ) ;
Original file line number Diff line number Diff line change @@ -21,4 +21,20 @@ test("nested array", () => {
21
21
] ) ;
22
22
} ) ;
23
23
24
+ test ( "object in array in object" , ( ) => {
25
+ assert . equal (
26
+ diff (
27
+ { test : [ "test" , { test : true } ] } ,
28
+ { test : [ "test" , { test : false } ] }
29
+ ) ,
30
+ [
31
+ {
32
+ type : "CHANGE" ,
33
+ path : [ "test" , "1" , "test" ] ,
34
+ value : false ,
35
+ } ,
36
+ ]
37
+ ) ;
38
+ } ) ;
39
+
24
40
test . run ( ) ;
You can’t perform that action at this time.
0 commit comments