Total Complexity | 11 |
Complexity/F | 5.5 |
Lines of Code | 28 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 2 |
1 | /* |
||
11 | export const stateGetter = (state, props, key, entry) => { |
||
12 | |||
13 | if (props |
||
14 | && props.reducerKeys |
||
15 | && Object.keys(props.reducerKeys).length > 0 |
||
16 | && props.reducerKeys[key]) { |
||
17 | |||
18 | const dynamicKey = props.reducerKeys[key]; |
||
19 | const dynamicState = get(state, dynamicKey, entry); |
||
20 | |||
21 | return dynamicState; |
||
22 | } |
||
23 | |||
24 | const val = get(state, key, entry); |
||
25 | |||
26 | if (val) { |
||
27 | return val; |
||
28 | } |
||
29 | |||
30 | return null; |
||
31 | }; |
||
32 | |||
33 | export const get = (state, key, entry) => state |
||
34 | && state[key] |
||
35 | && state[key].get |
||
36 | && state[key].get(entry) |
||
37 | ? state[key].get(entry) |
||
38 | : null; |
||
39 |