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 ( 1fd1c7...b7b3db )
by Benjamin
05:23
created

src/util/getColumnsFromStorage.js   A

Complexity

Total Complexity 8
Complexity/F 1.6

Size

Lines of Code 41
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 0
wmc 8
c 1
b 1
f 0
nc 1
mnd 1
bc 6
fnc 5
dl 0
loc 41
rs 10
bpm 1.2
cpm 1.6
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
B getColumnsFromStorage.js ➔ ??? 0 35 2
1
import { nameFromDataIndex } from './getData';
2
3
// properties to map from state
4
// order is an implicit prop
5
const mappableProps = ['hidden', 'width'];
6
7
export const getColumnsFromStorage = (fromStorage, columns) => {
0 ignored issues
show
Unused Code introduced by
The constant getColumnsFromStorage seems to be never used. Consider removing it.
Loading history...
8
9
    const ret = [];
10
    const foundValues = [];
11
12
    fromStorage.forEach(col => {
13
14
        const dataIndex = nameFromDataIndex(col);
15
        const colFromProp = columns
16
            .find(c => nameFromDataIndex(c) === dataIndex);
17
18
        if (!colFromProp) {
19
            return;
20
        }
21
22
        foundValues.push(dataIndex);
23
24
        mappableProps.forEach(prop => {
25
26
            if (col[prop] !== undefined) {
27
                colFromProp[prop] = col[prop];
28
            }
29
        });
30
31
        ret.push(colFromProp);
32
    });
33
34
    if (foundValues.length !== columns.length) {
35
        const unused = columns
36
            .filter(c => foundValues.indexOf(nameFromDataIndex(c)) === -1);
37
        ret.unshift.apply(ret, unused);
38
    }
39
40
    return ret;
41
};
42