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.
Passed
Push — master ( 43bb89...906335 )
by Benjamin
01:58
created

getUpdatedRecord.js ➔ ???   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
nc 2
dl 0
loc 17
rs 9.2
nop 5
1
/**
2
* utility classed used by all reducers to
3
* update their internal Immutable records
4
* @param {object}  state
5
* @param {string} stateKey
6
* @param {object} values
7
* @param {Immutable.Record} type
8
* @param {string} operation
9
**/
10
11
import { fromJS } from 'immutable';
12
13
export const getUpdatedDataRecord = (
14
    state, stateKey, values = {}, type, operation = 'setIn'
15
) => {
16
    if (operation === 'setIn') {
17
        return state[operation]([stateKey], new type(values));
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like type should be capitalized.
Loading history...
18
    }
19
20
    else if (operation === 'mergeIn') {
21
        const p = state.get(stateKey)
22
            ? state.get(stateKey)
23
            : fromJS({});
24
25
        return state[operation]([stateKey], p.merge(values));
26
    }
27
28
    throw new Error('Update operation has not been implemented!');
29
};
30
31
export default getUpdatedDataRecord;
32