Total Complexity | 5 |
Complexity/F | 1.25 |
Lines of Code | 21 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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 |