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.
Test Failed
Pull Request — master (#10)
by Cedric
01:26
created

src/Model/Store.js   A

Size

Lines of Code 59

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
dl 0
loc 59
rs 10
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A Store.js ➔ ??? 0 3 1
1
export default class InMemoryStore {
2
3
    constructor (initialStore = {}) {
4
        this._store = initialStore;
5
    }
6
7
    _recurse (key, value) {
8
9
        if (key === undefined) {
10
            return this._store;
11
        }
12
13
        let writeMode = value !== undefined;
14
15
        let currentLevel = this._store;
16
        let levels = key.split('.');
17
18
        for (let i = 0, l = levels.length; i < l; i++) {
19
            if (!writeMode && currentLevel[levels[i]] === undefined) {
20
                return null;
21
            }
22
23
            if (!writeMode) {
24
                currentLevel = currentLevel[levels[i]];
25
                continue;
26
            }
27
28
            if (currentLevel[levels[i]] === undefined) {
29
                currentLevel[levels[i]] = {};
30
            }
31
32
            if (i + 1 === l) {
33
                currentLevel[levels[i]] = value;
34
            }
35
36
            currentLevel = currentLevel[levels[i]];
37
        }
38
39
        return currentLevel;
40
    }
41
42
    get (key, defaultValue = null) {
43
        return this._recurse(key) || defaultValue;
44
    }
45
46
    set (key, value) {
47
        this._recurse(key, value);
48
        return this;
49
    }
50
51
    reset () {
52
        this._store = {};
53
    }
54
55
    toJS () {
56
        return this._store;
57
    }
58
59
}
60