File tree Expand file tree Collapse file tree 5 files changed +23
-8
lines changed Expand file tree Collapse file tree 5 files changed +23
-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 @@ -15,6 +15,7 @@ describe('.addedDiff', () => {
15
15
[ 'function' , ( ) => ( { } ) ] ,
16
16
[ 'date' , new Date ( ) ] ,
17
17
] ) ( 'returns empty object when given values of type %s are equal' , ( type , value ) => {
18
+ console . log ( 'here yub' )
18
19
expect ( addedDiff ( value , value ) ) . toEqual ( { } ) ;
19
20
} ) ;
20
21
} ) ;
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 = properObject ( rhs ) ;
10
10
11
11
const deletedValues = Object . keys ( l ) . reduce ( ( acc , key ) => {
12
- return r . hasOwnProperty ( key ) ? acc : { ...acc , [ key ] : undefined } ;
12
+ if ( ! r . hasOwnProperty ( key ) ) {
13
+ acc [ key ] = undefined ;
14
+
15
+ }
16
+
17
+ return acc ;
13
18
} , { } ) ;
14
19
15
20
if ( isDate ( l ) || isDate ( r ) ) {
@@ -18,13 +23,17 @@ const diff = (lhs, rhs) => {
18
23
}
19
24
20
25
return Object . keys ( r ) . reduce ( ( acc , key ) => {
21
- if ( ! l . hasOwnProperty ( key ) ) return { ...acc , [ key ] : r [ key ] } ; // return added r key
26
+ if ( ! l . hasOwnProperty ( 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 ( isObject ( difference ) && isEmpty ( difference ) && ! isDate ( difference ) ) return acc ; // return no diff
26
34
27
- return { ...acc , [ key ] : difference } ; // return updated key
35
+ acc [ key ] = difference // return updated key
36
+ return acc ; // return updated key
28
37
} , deletedValues ) ;
29
38
} ;
30
39
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ const updatedDiff = (lhs, rhs) => {
21
21
22
22
if ( isObject ( difference ) && isEmpty ( difference ) && ! isDate ( difference ) ) return acc ;
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