GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( cc0130...b571b0 )
by Benjamin
01:46
created

src/util/stateGetter.js   A

Complexity

Total Complexity 11
Complexity/F 5.5

Size

Lines of Code 28
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 2
Metric Value
cc 0
wmc 11
c 3
b 0
f 2
nc 1
mnd 1
bc 3
fnc 2
dl 0
loc 28
rs 10
bpm 1.5
cpm 5.5
noi 0
1
/*
2
* central function to retrieve state from reducer
3
* used inside of mapStateToProps by grid and other plugins
4
* @returns {object} state
5
6
* if a dynamic reducerKey is passed, it will favor that key
7
* over the build in grid keys
8
9
*/
10
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