File tree Expand file tree Collapse file tree 4 files changed +22
-8
lines changed Expand file tree Collapse file tree 4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,12 @@ const addedDiff = (lhs, rhs) => {
13
13
14
14
if ( isObject ( difference ) && isEmpty ( difference ) ) return acc ;
15
15
16
- return { ...acc , [ key ] : difference } ;
16
+ acc [ key ] = difference ;
17
+ return acc ;
17
18
}
18
19
19
- return { ...acc , [ key ] : r [ key ] } ;
20
+ acc [ key ] = r [ key ] ;
21
+ return acc ;
20
22
} , { } ) ;
21
23
} ;
22
24
Original file line number Diff line number Diff line change @@ -12,10 +12,12 @@ const deletedDiff = (lhs, rhs) => {
12
12
13
13
if ( isObject ( difference ) && isEmpty ( difference ) ) return acc ;
14
14
15
- return { ...acc , [ key ] : difference } ;
15
+ acc [ key ] = difference ;
16
+ return acc ;
16
17
}
17
18
18
- return { ...acc , [ key ] : undefined } ;
19
+ acc [ key ] = undefined ;
20
+ return acc ;
19
21
} , { } ) ;
20
22
} ;
21
23
Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ const diff = (lhs, rhs) => {
9
9
const r = rhs ;
10
10
11
11
const deletedValues = Object . keys ( l ) . reduce ( ( acc , key ) => {
12
- return hasOwnProperty ( r , key ) ? acc : { ...acc , [ key ] : undefined } ;
12
+ if ( ! hasOwnProperty ( r , key ) ) {
13
+ acc [ key ] = undefined ;
14
+
15
+ }
16
+
17
+ return acc ;
13
18
} , { } ) ;
14
19
15
20
if ( isDate ( l ) || isDate ( r ) ) {
@@ -18,15 +23,19 @@ const diff = (lhs, rhs) => {
18
23
}
19
24
20
25
return Object . keys ( r ) . reduce ( ( acc , key ) => {
21
- if ( ! hasOwnProperty ( l , key ) ) return { ...acc , [ key ] : r [ key ] } ; // return added r key
26
+ if ( ! hasOwnProperty ( l , key ) ) {
27
+ acc [ key ] = r [ key ] ; // return added r key
28
+ return acc ;
29
+ }
22
30
23
31
const difference = diff ( l [ key ] , r [ key ] ) ;
24
32
25
33
// If the difference is empty, and the lhs is an empty object or the rhs is not an empty object
26
34
if ( isEmptyObject ( difference ) && ! isDate ( difference ) && ( isEmptyObject ( l [ key ] ) || ! isEmptyObject ( r [ key ] ) ) )
27
35
return acc ; // return no diff
28
36
29
- return { ...acc , [ key ] : difference } ; // return updated key
37
+ acc [ key ] = difference // return updated key
38
+ return acc ; // return updated key
30
39
} , deletedValues ) ;
31
40
} ;
32
41
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ const updatedDiff = (lhs, rhs) => {
21
21
if ( isEmptyObject ( difference ) && ! isDate ( difference ) && ( isEmptyObject ( l [ key ] ) || ! isEmptyObject ( r [ key ] ) ) )
22
22
return acc ; // return no diff
23
23
24
- return { ...acc , [ key ] : difference } ;
24
+ acc [ key ] = difference ;
25
+ return acc ;
25
26
}
26
27
27
28
return acc ;
You can’t perform that action at this time.
0 commit comments