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
Pull Request — master (#8)
by Cedric
01:27
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 100%

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
rs 10
bpm 1.8
cpm 2.6
noi 3
ccs 21
cts 21
cp 1
crap 0
1 38
export const isInt = (val) => !isNaN(val)
2
    && eval(val)
0 ignored issues
show
Security Performance introduced by
Calls to eval are slow and potentially dangerous, especially on untrusted code. Please consider whether there is another way to achieve your goal.
Loading history...
3
        .toString().length
4
    === parseInt(eval(val))
0 ignored issues
show
Security Performance introduced by
Calls to eval are slow and potentially dangerous, especially on untrusted code. Please consider whether there is another way to achieve your goal.
Loading history...
5
        .toString().length;
6
7
8 23
export const isFloat = (val) => !isNaN(val)
9
    && !isInt(eval(val))
0 ignored issues
show
Security Performance introduced by
Calls to eval are slow and potentially dangerous, especially on untrusted code. Please consider whether there is another way to achieve your goal.
Loading history...
10
    && val.toString().length > 0;
11
12 64
export const isColor = (val) => /^#?[0-9A-F]{6}$/i.test(val);
13
14 1
export const autoCast = (value) => {
15 56
    if (!value) {
16 2
        return value;
17
    }
18
19 54
    if (isColor(value)) {
20 34
        return ('#' + value).replace('##', '#');
21
    }
22
23 20
    if (isInt(value)) {
24 7
        return parseInt(value, 10);
25
    }
26
27 13
    if (isFloat(value)) {
28 3
        return parseFloat(value);
29
    }
30
31 10
    if (value.toLowerCase() === 'true') {
32 3
        return true;
33
    }
34
35 7
    if (value.toLowerCase() === 'false') {
36 2
        return false;
37
    }
38
39 5
    return value;
40
};
41
42
43 1
export const castString = (str) => {
44 103
    if (typeof str !== 'string' && !(str instanceof String)) {
45 4
        str = '' + str;
46
    }
47
48 103
    return str.toLowerCase();
49
};
50