fixed issues identified by codeclimate
Costa Tsaousis (ktsaou) committed
Apr 19, 2017 at 23:07 UTC
79e12a3d75250e7a8696a7d3d827d924aafe33c4
1 file changed
+15
-15
web/dashboard.js
+15
-15
@@ -743,8 +743,8 @@ var NETDATA = window.NETDATA || {};
743
// this is the fastest and the preferred
744
getIntlNumberFormat: function(min, max) {
745
var key = max;
746
- if(min == max) {
747
- if(typeof this.formatters_fixed[key] == 'undefined')
746
+ if(min === max) {
747
+ if(typeof this.formatters_fixed[key] === 'undefined')
748
this.formatters_fixed[key] = new Intl.NumberFormat(undefined, {
749
// style: 'decimal',
750
// minimumIntegerDigits: 1,
@@ -757,8 +757,8 @@ var NETDATA = window.NETDATA || {};
757
758
return this.formatters_fixed[key];
759
}
760
- else if(min == 0) {
761
- if(typeof this.formatters_zero_based[key] == 'undefined')
760
+ else if(min === 0) {
761
+ if(typeof this.formatters_zero_based[key] === 'undefined')
762
this.formatters_zero_based[key] = new Intl.NumberFormat(undefined, {
763
// style: 'decimal',
764
// minimumIntegerDigits: 1,
@@ -789,8 +789,8 @@ var NETDATA = window.NETDATA || {};
789
// this respects locale
790
getLocaleString: function(min, max) {
791
var key = max;
792
- if(min == max) {
793
- if(typeof this.formatters_fixed[key] == 'undefined')
792
+ if(min === max) {
793
+ if(typeof this.formatters_fixed[key] === 'undefined')
794
this.formatters_fixed[key] = {
795
format: function (value) {
796
return value.toLocaleString(undefined, {
@@ -807,8 +807,8 @@ var NETDATA = window.NETDATA || {};
807
808
return this.formatters_fixed[key];
809
}
810
- else if(min == 0) {
811
- if(typeof this.formatters_zero_based[key] == 'undefined')
810
+ else if(min === 0) {
811
+ if(typeof this.formatters_zero_based[key] === 'undefined')
812
this.formatters_zero_based[key] = {
813
format: function (value) {
814
return value.toLocaleString(undefined, {
@@ -844,8 +844,8 @@ var NETDATA = window.NETDATA || {};
844
845
getFixed: function(min, max) {
846
var key = max;
847
- if(min == max) {
848
- if(typeof this.formatters_fixed[key] == 'undefined')
847
+ if(min === max) {
848
+ if(typeof this.formatters_fixed[key] === 'undefined')
849
this.formatters_fixed[key] = {
850
format: function (value) {
851
if(value === 0) return "0";
@@ -855,8 +855,8 @@ var NETDATA = window.NETDATA || {};
855
856
return this.formatters_fixed[key];
857
}
858
- else if(min == 0) {
859
- if(typeof this.formatters_zero_based[key] == 'undefined')
858
+ else if(min === 0) {
859
+ if(typeof this.formatters_zero_based[key] === 'undefined')
860
this.formatters_zero_based[key] = {
861
format: function (value) {
862
if(value === 0) return "0";
@@ -895,7 +895,7 @@ var NETDATA = window.NETDATA || {};
895
}
896
897
// console.log('NumberFormat: ', s);
898
- return (s == e1 || s == e2);
898
+ return (s === e1 || s === e2);
899
},
900
901
testLocaleString: function() {
@@ -915,7 +915,7 @@ var NETDATA = window.NETDATA || {};
915
}
916
917
// console.log('localeString: ', s);
918
- return (s == e1 || s == e2);
918
+ return (s === e1 || s === e2);
919
},
920
921
// on first run we decide which formatter to use
@@ -2485,7 +2485,7 @@ var NETDATA = window.NETDATA || {};
2485
else __legendFormatValueChartDecimals = 4;
2486
}
2487
2488
- if(__legendFormatValueChartDecimals != old) {
2488
+ if(__legendFormatValueChartDecimals !== old) {
2489
if(__legendFormatValueChartDecimals < 0)
2490
__intlNumberFormat = null;
2491
else