Conditions | 4 |
Paths | 2 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
13 | export const getUpdatedDataRecord = ( |
||
14 | state, stateKey, values = {}, type, operation = 'setIn' |
||
15 | ) => { |
||
16 | if (operation === 'setIn') { |
||
17 | return state[operation]([stateKey], new type(values)); |
||
|
|||
18 | } |
||
19 | |||
20 | else if (operation === 'mergeIn') { |
||
21 | const p = state.get(stateKey) |
||
22 | ? state.get(stateKey) |
||
23 | : fromJS({}); |
||
24 | |||
25 | return state[operation]([stateKey], p.merge(values)); |
||
26 | } |
||
27 | |||
28 | throw new Error('Update operation has not been implemented!'); |
||
29 | }; |
||
30 | |||
32 |