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.

src/util/elementContains.js   A
last analyzed

Complexity

Total Complexity 10
Complexity/F 10

Size

Lines of Code 17
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
wmc 10
nc 1
mnd 4
bc 6
fnc 1
dl 0
loc 17
rs 10
bpm 6
cpm 10
noi 1
c 0
b 0
f 0
1
export function elementContains(el, ...classes) {
2
3
    if (!el || !classes || !classes.length) {
4
        throw Error('Function requires a dom node and a classname');
5
    }
6
7
    while (el && el !== document.body) {
8
        if (el && el.classList) {
9
            for (let i = 0; i < classes.length; i++) {
10
                if (el.classList.contains(classes[i])) {
11
                    return true;
12
                }
13
            }
14
        }
15
        el = el.parentNode;
16
    }
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
17
}