From: Alexander Moisseev Date: Wed, 11 Jul 2018 07:44:27 +0000 (+0300) Subject: [WebUI] Use self-explanatory notation X-Git-Tag: 1.7.8~5^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f98d6e900feba2726ea548895b645d9455656d57;p=rspamd.git [WebUI] Use self-explanatory notation for type conversion --- diff --git a/.eslintrc.json b/.eslintrc.json index 32530cd18..ee10918bb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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", diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js index cce3c028c..7ff570852 100644 --- a/interface/js/app/graph.js +++ b/interface/js/app/graph.js @@ -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, }; }, []); diff --git a/interface/js/app/history.js b/interface/js/app/history.js index 6ee62c0ac..573a21407 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -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]; }); }; diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index 039983534..ac569ee9d 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -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 {