Total Complexity | 65 |
Complexity/F | 2.32 |
Lines of Code | 149 |
Function Count | 28 |
Duplicated Lines | 127 |
Ratio | 85.23 % |
Changes | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like public/js/modernizr.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
1 | View Code Duplication | /******/ (function(modules) { // webpackBootstrap |
|
|
|||
2 | /******/ // The module cache |
||
3 | /******/ var installedModules = {}; |
||
4 | /******/ |
||
5 | /******/ // The require function |
||
6 | /******/ function __webpack_require__(moduleId) { |
||
7 | /******/ |
||
8 | /******/ // Check if module is in cache |
||
9 | /******/ if(installedModules[moduleId]) { |
||
10 | /******/ return installedModules[moduleId].exports; |
||
11 | /******/ } |
||
12 | /******/ // Create a new module (and put it into the cache) |
||
13 | /******/ var module = installedModules[moduleId] = { |
||
14 | /******/ i: moduleId, |
||
15 | /******/ l: false, |
||
16 | /******/ exports: {} |
||
17 | /******/ }; |
||
18 | /******/ |
||
19 | /******/ // Execute the module function |
||
20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
||
21 | /******/ |
||
22 | /******/ // Flag the module as loaded |
||
23 | /******/ module.l = true; |
||
24 | /******/ |
||
25 | /******/ // Return the exports of the module |
||
26 | /******/ return module.exports; |
||
27 | /******/ } |
||
28 | /******/ |
||
29 | /******/ |
||
30 | /******/ // expose the modules object (__webpack_modules__) |
||
31 | /******/ __webpack_require__.m = modules; |
||
32 | /******/ |
||
33 | /******/ // expose the module cache |
||
34 | /******/ __webpack_require__.c = installedModules; |
||
35 | /******/ |
||
36 | /******/ // define getter function for harmony exports |
||
37 | /******/ __webpack_require__.d = function(exports, name, getter) { |
||
38 | /******/ if(!__webpack_require__.o(exports, name)) { |
||
39 | /******/ Object.defineProperty(exports, name, { |
||
40 | /******/ configurable: false, |
||
41 | /******/ enumerable: true, |
||
42 | /******/ get: getter |
||
43 | /******/ }); |
||
44 | /******/ } |
||
45 | /******/ }; |
||
46 | /******/ |
||
47 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
||
48 | /******/ __webpack_require__.n = function(module) { |
||
49 | /******/ var getter = module && module.__esModule ? |
||
50 | /******/ function getDefault() { return module['default']; } : |
||
51 | /******/ function getModuleExports() { return module; }; |
||
52 | /******/ __webpack_require__.d(getter, 'a', getter); |
||
53 | /******/ return getter; |
||
54 | /******/ }; |
||
55 | /******/ |
||
56 | /******/ // Object.prototype.hasOwnProperty.call |
||
57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
||
58 | /******/ |
||
59 | /******/ // __webpack_public_path__ |
||
60 | /******/ __webpack_require__.p = "/"; |
||
61 | /******/ |
||
62 | /******/ // Load entry module and return exports |
||
63 | /******/ return __webpack_require__(__webpack_require__.s = 3); |
||
64 | /******/ }) |
||
65 | /************************************************************************/ |
||
66 | /******/ ({ |
||
67 | |||
68 | /***/ "./resources/assets/js/modernizr.js": |
||
69 | /***/ (function(module, exports) { |
||
70 | |||
71 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
||
72 | |||
73 | /*! modernizr 3.5.0 (Custom Build) | MIT * |
||
74 | * https://modernizr.com/download/?-emoji-svg-touchevents-setclasses !*/ |
||
75 | View Code Duplication | !function (e, t, n) { |
|
76 | function o(e, t) { |
||
77 | return (typeof e === "undefined" ? "undefined" : _typeof(e)) === t; |
||
78 | }function a() { |
||
79 | var e, t, n, a, s, i, r;for (var l in c) { |
||
80 | if (c.hasOwnProperty(l)) { |
||
81 | if (e = [], t = c[l], t.name && (e.push(t.name.toLowerCase()), t.options && t.options.aliases && t.options.aliases.length)) for (n = 0; n < t.options.aliases.length; n++) { |
||
82 | e.push(t.options.aliases[n].toLowerCase()); |
||
83 | }for (a = o(t.fn, "function") ? t.fn() : t.fn, s = 0; s < e.length; s++) { |
||
84 | i = e[s], r = i.split("."), 1 === r.length ? Modernizr[r[0]] = a : (!Modernizr[r[0]] || Modernizr[r[0]] instanceof Boolean || (Modernizr[r[0]] = new Boolean(Modernizr[r[0]])), Modernizr[r[0]][r[1]] = a), f.push((a ? "" : "no-") + r.join("-")); |
||
85 | } |
||
86 | } |
||
87 | } |
||
88 | }function s(e) { |
||
89 | var t = u.className, |
||
90 | n = Modernizr._config.classPrefix || "";if (p && (t = t.baseVal), Modernizr._config.enableJSClass) { |
||
91 | var o = new RegExp("(^|\\s)" + n + "no-js(\\s|$)");t = t.replace(o, "$1" + n + "js$2"); |
||
92 | }Modernizr._config.enableClasses && (t += " " + n + e.join(" " + n), p ? u.className.baseVal = t : u.className = t); |
||
93 | }function i() { |
||
94 | return "function" != typeof t.createElement ? t.createElement(arguments[0]) : p ? t.createElementNS.call(t, "http://www.w3.org/2000/svg", arguments[0]) : t.createElement.apply(t, arguments); |
||
95 | }function r() { |
||
96 | var e = t.body;return e || (e = i(p ? "svg" : "body"), e.fake = !0), e; |
||
97 | }function l(e, n, o, a) { |
||
98 | var s, |
||
99 | l, |
||
100 | f, |
||
101 | c, |
||
102 | d = "modernizr", |
||
103 | p = i("div"), |
||
104 | v = r();if (parseInt(o, 10)) for (; o--;) { |
||
105 | f = i("div"), f.id = a ? a[o] : d + (o + 1), p.appendChild(f); |
||
106 | }return s = i("style"), s.type = "text/css", s.id = "s" + d, (v.fake ? v : p).appendChild(s), v.appendChild(p), s.styleSheet ? s.styleSheet.cssText = e : s.appendChild(t.createTextNode(e)), p.id = d, v.fake && (v.style.background = "", v.style.overflow = "hidden", c = u.style.overflow, u.style.overflow = "hidden", u.appendChild(v)), l = n(p, e), v.fake ? (v.parentNode.removeChild(v), u.style.overflow = c, u.offsetHeight) : p.parentNode.removeChild(p), !!l; |
||
107 | }var f = [], |
||
108 | c = [], |
||
109 | d = { _version: "3.5.0", _config: { classPrefix: "", enableClasses: !0, enableJSClass: !0, usePrefixes: !0 }, _q: [], on: function on(e, t) { |
||
110 | var n = this;setTimeout(function () { |
||
111 | t(n[e]); |
||
112 | }, 0); |
||
113 | }, addTest: function addTest(e, t, n) { |
||
114 | c.push({ name: e, fn: t, options: n }); |
||
115 | }, addAsyncTest: function addAsyncTest(e) { |
||
116 | c.push({ name: null, fn: e }); |
||
117 | } }, |
||
118 | Modernizr = function Modernizr() {};Modernizr.prototype = d, Modernizr = new Modernizr(), Modernizr.addTest("svg", !!t.createElementNS && !!t.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect);var u = t.documentElement, |
||
119 | p = "svg" === u.nodeName.toLowerCase();Modernizr.addTest("canvas", function () { |
||
120 | var e = i("canvas");return !(!e.getContext || !e.getContext("2d")); |
||
121 | }), Modernizr.addTest("canvastext", function () { |
||
122 | return Modernizr.canvas === !1 ? !1 : "function" == typeof i("canvas").getContext("2d").fillText; |
||
123 | }), Modernizr.addTest("emoji", function () { |
||
124 | if (!Modernizr.canvastext) return !1;var t = e.devicePixelRatio || 1, |
||
125 | n = 12 * t, |
||
126 | o = i("canvas"), |
||
127 | a = o.getContext("2d");return a.fillStyle = "#f00", a.textBaseline = "top", a.font = "32px Arial", a.fillText("🐨", 0, 0), 0 !== a.getImageData(n, n, 1, 1).data[0]; |
||
128 | });var v = d._config.usePrefixes ? " -webkit- -moz- -o- -ms- ".split(" ") : ["", ""];d._prefixes = v;var m = d.testStyles = l;Modernizr.addTest("touchevents", function () { |
||
129 | var n;if ("ontouchstart" in e || e.DocumentTouch && t instanceof DocumentTouch) n = !0;else { |
||
130 | var o = ["@media (", v.join("touch-enabled),("), "heartz", ")", "{#modernizr{top:9px;position:absolute}}"].join("");m(o, function (e) { |
||
131 | n = 9 === e.offsetTop; |
||
132 | }); |
||
133 | }return n; |
||
134 | }), a(), s(f), delete d.addTest, delete d.addAsyncTest;for (var h = 0; h < Modernizr._q.length; h++) { |
||
135 | Modernizr._q[h](); |
||
136 | }e.Modernizr = Modernizr; |
||
137 | }(window, document); |
||
138 | |||
139 | /***/ }), |
||
140 | |||
141 | /***/ 3: |
||
142 | /***/ (function(module, exports, __webpack_require__) { |
||
143 | |||
144 | module.exports = __webpack_require__("./resources/assets/js/modernizr.js"); |
||
145 | |||
146 | |||
147 | /***/ }) |
||
148 | |||
149 | /******/ }); |