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

getColumnsFromStorage.js ➔ ... ➔ ???   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
cc 2
c 2
b 2
f 0
nc 2
dl 0
loc 21
rs 9.3142
nop 1
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