]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Use self-explanatory notation
authorAlexander Moisseev <moiseev@mezonplus.ru>
Wed, 11 Jul 2018 07:44:27 +0000 (10:44 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Wed, 11 Jul 2018 07:44:27 +0000 (10:44 +0300)
for type conversion

.eslintrc.json
interface/js/app/graph.js
interface/js/app/history.js
interface/js/app/symbols.js

index 32530cd18ec8eb70578e1c01cce0ad8168908c36..ee10918bb43fd82510ee0e73388744748c939f11 100644 (file)
@@ -72,7 +72,6 @@
         "no-empty": "off",
         "no-empty-function": "off",
         "no-eq-null": "off",
-        "no-implicit-coercion": "off",
         "no-inline-comments": "off",
         "no-loop-func": "off",
         "no-negated-condition": "off",
index cce3c028c55a8456e5e90894b0adefebd43ea605..7ff5708520cee0030b3d643815373be76a2719a1 100644 (file)
@@ -121,16 +121,16 @@ define(["jquery", "d3evolution", "footable"],
             // Time intervals that don't have data are excluded from average calculation as d3.mean()ignores nulls
                 var avg = d3.mean(curr, function (d) { return d.y; });
                 // To find an integral on the whole time interval we need to convert nulls to zeroes
-                var value = d3.mean(curr, function (d) { return +d.y; }) * timeInterval / scaleFactor;
+                var value = d3.mean(curr, function (d) { return Number(d.y); }) * timeInterval / scaleFactor;
                 var yExtents = d3.extent(curr, function (d) { return d.y; });
 
                 return {
                     label: graph_options.legend.entries[i].label,
                     value: value ^ 0, // eslint-disable-line no-bitwise
-                    min: +yExtents[0].toFixed(6),
-                    avg: +avg.toFixed(6),
-                    max: +yExtents[1].toFixed(6),
-                    last: +curr[curr.length - 1].y.toFixed(6),
+                    min: Number(yExtents[0].toFixed(6)),
+                    avg: Number(avg.toFixed(6)),
+                    max: Number(yExtents[1].toFixed(6)),
+                    last: Number(curr[curr.length - 1].y.toFixed(6)),
                     color: graph_options.legend.entries[i].color,
                 };
             }, []);
index 6ee62c0ac9909f149ae60549b45108051f4e4456..573a214072befc53af0ede305f2161fde7a59f9b 100644 (file)
@@ -42,7 +42,7 @@ define(["jquery", "footable", "humanize"],
         var symbolDescriptions = {};
 
         var EscapeHTML = function (string) {
-            return ("" + string).replace(htmlEscaper, function (match) {
+            return (String(string)).replace(htmlEscaper, function (match) {
                 return htmlEscapes[match];
             });
         };
index 039983534042a70abf6abf7a563126b00f672583..ac569ee9d98538db7b93f1203710f14bb163db88 100644 (file)
@@ -72,7 +72,7 @@ define(["jquery", "footable"],
             }
         }
         function decimalStep(number) {
-            var digits = ((+number).toFixed(20)).replace(/^-?\d*\.?|0+$/g, "").length;
+            var digits = ((Number(number)).toFixed(20)).replace(/^-?\d*\.?|0+$/g, "").length;
             if (digits === 0 || digits > 4) {
                 return 0.1;
             } else {