src/lib/sleep.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 8
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
mnd 0
bc 0
fnc 3
dl 0
loc 8
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
/**
2
 * sleep for n ms before resolving the Promise
3
 *
4
 * @param  {Number} time duration in ms
5
 * @returns {Promise} a Promise for async/await control flow
6
 */
7
const sleep = (time) =>
8
  new Promise((resolve) => {
9
    setTimeout(() => {
10
      resolve();
11
    }, time);
12
  });
13
14
export default sleep;
15