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

addHotMiddleware.js ➔ ... ➔ ???   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 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