Conditions | 8 |
Paths | 6 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | /* |
||
11 | export const stateGetter = (state, props, key, entry) => { |
||
12 | |||
13 | if (props && props.reducerKeys) { |
||
14 | if (typeof props.reducerKeys === 'string') { |
||
15 | return get(state[props.reducerKeys], key, entry); |
||
16 | } |
||
17 | else if (typeof props.reducerKeys === 'object' && |
||
18 | Object.keys(props.reducerKeys).length > 0 && |
||
19 | props.reducerKeys[key]) { |
||
20 | |||
21 | const dynamicKey = props.reducerKeys[key]; |
||
22 | const dynamicState = get(state, dynamicKey, entry); |
||
23 | |||
24 | return dynamicState; |
||
25 | } |
||
26 | } |
||
27 | |||
28 | const val = get(state, key, entry); |
||
29 | |||
30 | if (val) { |
||
31 | return val; |
||
32 | } |
||
33 | |||
34 | return null; |
||
35 | }; |
||
36 | |||
54 |