Passed
Push — master ( 50adea...d5902b )
by Amit
02:19
created

assets/build/util/addHotMiddleware.js   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 10
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
nc 2
dl 0
loc 10
rs 10
c 1
b 0
f 0
wmc 3
mnd 1
bc 2
fnc 2
bpm 1
cpm 1.5
noi 0
1
/**
2
 * Loop through webpack entry
3
 * and add the hot middleware
4
 * @param  {Object} entry webpack entry
5
 * @return {Object} entry with hot middleware
6
 */
7
module.exports = (entry) => {
8
  const results = {};
9
  const hotMiddlewareScript = 'webpack-hot-middleware/client?timeout=20000&reload=true';
10
11
  Object.keys(entry).forEach((name) => {
12
    results[name] = Array.isArray(entry[name]) ? entry[name].slice(0) : [entry[name]];
13
    results[name].unshift(hotMiddlewareScript);
14
  });
15
  return results;
16
};
17