@@ -5,33 +5,30 @@ const diff = (lhs, rhs) => {
55
66 if ( ! isObject ( lhs ) || ! isObject ( rhs ) ) return rhs ; // return updated rhs
77
8- const l = lhs ;
9- const r = rhs ;
10-
11- const deletedValues = Object . keys ( l ) . reduce ( ( acc , key ) => {
12- if ( ! hasOwnProperty ( r , key ) ) {
8+ const deletedValues = Object . keys ( lhs ) . reduce ( ( acc , key ) => {
9+ if ( ! hasOwnProperty ( rhs , key ) ) {
1310 acc [ key ] = undefined ;
1411
1512 }
1613
1714 return acc ;
1815 } , makeObjectWithoutPrototype ( ) ) ;
1916
20- if ( isDate ( l ) || isDate ( r ) ) {
21- if ( l . valueOf ( ) == r . valueOf ( ) ) return { } ;
22- return r ;
17+ if ( isDate ( lhs ) || isDate ( rhs ) ) {
18+ if ( lhs . valueOf ( ) == rhs . valueOf ( ) ) return { } ;
19+ return rhs ;
2320 }
2421
25- return Object . keys ( r ) . reduce ( ( acc , key ) => {
26- if ( ! hasOwnProperty ( l , key ) ) {
27- acc [ key ] = r [ key ] ; // return added r key
22+ return Object . keys ( rhs ) . reduce ( ( acc , key ) => {
23+ if ( ! hasOwnProperty ( lhs , key ) ) {
24+ acc [ key ] = rhs [ key ] ; // return added r key
2825 return acc ;
2926 }
3027
31- const difference = diff ( l [ key ] , r [ key ] ) ;
28+ const difference = diff ( lhs [ key ] , rhs [ key ] ) ;
3229
3330 // If the difference is empty, and the lhs is an empty object or the rhs is not an empty object
34- if ( isEmptyObject ( difference ) && ! isDate ( difference ) && ( isEmptyObject ( l [ key ] ) || ! isEmptyObject ( r [ key ] ) ) )
31+ if ( isEmptyObject ( difference ) && ! isDate ( difference ) && ( isEmptyObject ( lhs [ key ] ) || ! isEmptyObject ( rhs [ key ] ) ) )
3532 return acc ; // return no diff
3633
3734 acc [ key ] = difference // return updated key
0 commit comments