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/lib/utils.js   A

Complexity

Total Complexity 13
Complexity/F 2.6

Size

Lines of Code 49
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 57.14%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 13
c 1
b 0
f 0
nc 1
mnd 1
bc 9
fnc 5
dl 0
loc 49
ccs 12
cts 21
cp 0.5714
crap 0
rs 10
bpm 1.8
cpm 2.6
noi 0
1 4
export const isInt = (val) => !isNaN(val)
2
    && (
3
        Number.isInteger(val)
4
        || (typeof val === 'string' && '' + parseInt(val, 10) === val)
5
    );
6
7
8 3
export const isFloat = (val) => !isNaN(val)
9
    && !isInt(val)
10
    && val.toString().length > 0;
11
12 1
export const isColor = (val) => /^#?[0-9A-F]{6}$/i.test(val);
13
14 1
export const autoCast = (value) => {
15 2
    if (!value) {
16
        return value;
17
    }
18
19 2
    if (isColor(value)) {
20
        return ('#' + value).replace('##', '#');
21
    }
22
23 2
    if (isInt(value)) {
24
        return parseInt(value, 10);
25
    }
26
27 2
    if (isFloat(value)) {
28
        return parseFloat(value);
29
    }
30
31 2
    if (value.toLowerCase() === 'true') {
32
        return true;
33
    }
34
35 2
    if (value.toLowerCase() === 'false') {
36
        return false;
37
    }
38
39
    return value;
40
};
41
42
43 1
export const castString = (str) => {
44 4
    if (typeof str !== 'string' && !(str instanceof String)) {
45
        str = '' + str;
46
    }
47
48
    return str.toLowerCase();
49
};
50