src/common.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 21
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 11
mnd 1
bc 1
fnc 4
dl 0
loc 21
rs 10
bpm 0.25
cpm 1.25
noi 0
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A common.js ➔ pause 0 3 2
A common.js ➔ getEscapedRegExp 0 6 1
1
export function getPropertyDescriptor(obj, prop) {
2
    let desc;
3
4
    do {
5
        desc = Object.getOwnPropertyDescriptor(obj, prop);
6
    // eslint-disable-next-line no-cond-assign
7
    } while (!desc && (obj = Object.getPrototypeOf(obj)));
8
9
    return desc;
10
}
11
12
export function pause(time) {
13
    return new Promise(res => setTimeout(res, time));
14
}
15
16
export function getEscapedRegExp(value) {
17
    const matchOperatorsRe = /[$()*+.?[\\\]^{|}]/g;
18
19
20
    return value.replace(matchOperatorsRe, '\\$&');
21
}
22