Skip to content

Commit 9097b2d

Browse files
authored
Merge pull request #392 from iLib-js/fixQTtcs
Fix test failures and some warning message on qt
2 parents 65f8ca0 + b29cf4b commit 9097b2d

20 files changed

+122
-79
lines changed

js/lib/Astro.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,14 +711,15 @@ Astro._newMoonTime = function(n) {
711711
var moonArgument = Astro._poly(c, ilib.data.astro._nmMoonArgumentCoeff);
712712
var capOmega = Astro._poly(c, ilib.data.astro._nmCapOmegaCoeff);
713713
var correction = -0.00017 * Astro._dsin(capOmega);
714-
for (var i = 0; i < ilib.data.astro._nmSineCoeff.length; i++) {
714+
var i;
715+
for (i = 0; i < ilib.data.astro._nmSineCoeff.length; i++) {
715716
correction = correction + ilib.data.astro._nmSineCoeff[i] * Math.pow(capE, ilib.data.astro._nmEFactor[i]) *
716717
Astro._dsin(ilib.data.astro._nmSolarCoeff[i] * solarAnomaly +
717718
ilib.data.astro._nmLunarCoeff[i] * lunarAnomaly +
718719
ilib.data.astro._nmMoonCoeff[i] * moonArgument);
719720
}
720721
var additional = 0;
721-
for (var i = 0; i < ilib.data.astro._nmAddConst.length; i++) {
722+
for (i = 0; i < ilib.data.astro._nmAddConst.length; i++) {
722723
additional = additional + ilib.data.astro._nmAddFactor[i] *
723724
Astro._dsin(ilib.data.astro._nmAddConst[i] + ilib.data.astro._nmAddCoeff[i] * k);
724725
}

js/lib/DateFmt.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,28 +454,28 @@ var DateFmt = function(options) {
454454
this.calName = this.calName || this.locinfo.getCalendar() || "gregorian";
455455

456456
if(this.useIntl && typeof(Intl) !== 'undefined' && Intl.DateTimeFormat.supportedLocalesOf(this.locale.getSpec()).length > 0 &&
457-
(this.locinfo.getDigitsStyle() == "western" && (!options.template) && this.calName == "gregorian")){
457+
(this.locinfo.getDigitsStyle() === "western" && (!options.template) && this.calName === "gregorian")){
458458
var len = DateFmt.lenmap[this.length];
459-
if(this.type == "date" &&
460-
((this.dateComponents == "dmy" && len != "full") || (this.dateComponents == "dmwy" && len == "full"))){
459+
if(this.type === "date" &&
460+
((this.dateComponents === "dmy" && len !== "full") || (this.dateComponents === "dmwy" && len === "full"))){
461461
this.IntlDateTimeObj = new Intl.DateTimeFormat(this.locale.getSpec(), {
462462
dateStyle: len
463463
});
464-
} else if (this.type == "time" &&
465-
this.timeComponents== "ahm" || this.timeComponents== "ahms"){
464+
} else if (this.type === "time" &&
465+
this.timeComponents === "ahm" || this.timeComponents === "ahms"){
466466
var timeMap = {
467467
"ahm": "short",
468468
"ahms": "medium"
469469
}
470470
this.IntlDateTimeObj = new Intl.DateTimeFormat(this.locale.getSpec(), {
471471
timeStyle: timeMap[this.timeComponents]
472472
});
473-
} else if (this.type == "date" && this.dateComponents == "m" && len == "full") {
473+
} else if (this.type === "date" && this.dateComponents === "m" && len === "full") {
474474
this.IntlDateTimeObj = new Intl.DateTimeFormat(this.locale.getSpec(), {
475475
month: "long"
476476
});
477477

478-
} else if (this.type == "date" && this.dateComponents == "w" && len == "full") {
478+
} else if (this.type === "date" && this.dateComponents === "w" && len === "full") {
479479
this.IntlDateTimeObj = new Intl.DateTimeFormat(this.locale.getSpec(), {
480480
weekday: "long"
481481
});

js/lib/DurationFmt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ DurationFmt.prototype.format = function (components) {
357357
//for (i = 0; i < list.length; i++) {
358358
for (i = list.length-1; i >= 0; i--) {
359359
//console.log("Now dealing with " + list[i]);
360-
if (typeof(components[list[i]]) !== 'undefined' && components[list[i]] != 0) {
360+
if (typeof(components[list[i]]) !== 'undefined' && components[list[i]] !== 0) {
361361
if (str.length > 0) {
362362
str = ((this.length === 'full' && secondlast) ? this.components.finalSeparator : this.components.separator) + str;
363363
secondlast = false;

js/lib/EthiopicCal.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ EthiopicCal.prototype.isLeapYear = function(year) {
9898
case "function":
9999
case "undefined":
100100
return false;
101-
break;
102101
}
103102
return MathUtils.mod(y, 4) === 3;
104103
};

js/lib/IString.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ IString._fncs = {
288288

289289
var exponentialNum = number.toExponential();
290290
var exponentialIndex = exponentialNum.indexOf("e");
291-
if (exponentialIndex != -1) {
291+
if (exponentialIndex !== -1) {
292292
operandSymbol.c = parseInt(exponentialNum[exponentialIndex+2]);
293293
operandSymbol.e = parseInt(exponentialNum[exponentialIndex+2]);
294294
} else {
@@ -344,7 +344,7 @@ IString._fncs = {
344344
is: function(rule, n) {
345345
var left = IString._fncs.getValue(rule[0], n);
346346
var right = IString._fncs.getValue(rule[1], n);
347-
return left == right;
347+
return left === right;
348348
},
349349

350350
/**
@@ -354,7 +354,7 @@ IString._fncs = {
354354
* @return {boolean}
355355
*/
356356
isnot: function(rule, n) {
357-
return IString._fncs.getValue(rule[0], n) != IString._fncs.getValue(rule[1], n);
357+
return IString._fncs.getValue(rule[0], n) !== IString._fncs.getValue(rule[1], n);
358358
},
359359

360360
/**
@@ -479,7 +479,7 @@ IString._fncs = {
479479
if(typeof(valueRight) === 'boolean') {
480480
return (valueRight ? true : false);
481481
} else {
482-
return (valueLeft == valueRight ? true :false);
482+
return (valueLeft === valueRight ? true :false);
483483
}
484484
},
485485
/**
@@ -850,6 +850,7 @@ IString.prototype = {
850850
var choices = this.str.split("|");
851851
var limits = [];
852852
var strings = [];
853+
var limitsArr = [];
853854
var i;
854855
var parts;
855856
var result = undefined;
@@ -892,7 +893,7 @@ IString.prototype = {
892893
var r = this.intlPlural.select(args[i]);
893894
this.cateArr.push(r);
894895
}
895-
if (args.length == 1) {
896+
if (args.length === 1) {
896897
var idx = limits.indexOf(this.cateArr[0]);
897898
if (idx == -1) {
898899
idx = limits.indexOf("");
@@ -905,7 +906,7 @@ IString.prototype = {
905906
this.findOne = false;
906907

907908
for(i = 0; !this.findOne && i < limits.length; i++){
908-
var limitsArr = (limits[i].indexOf(",") > -1) ? limits[i].split(",") : [limits[i]];
909+
limitsArr = (limits[i].indexOf(",") > -1) ? limits[i].split(",") : [limits[i]];
909910

910911
if (limitsArr.length > 1 && (limitsArr.length < this.cateArr.length)){
911912
this.cateArr = this.cateArr.slice(0,limitsArr.length);
@@ -920,7 +921,7 @@ IString.prototype = {
920921
}
921922
}));
922923
}
923-
if (this.number == -1){
924+
if (this.number === -1){
924925
this.number = limits.indexOf("");
925926
}
926927
result = new IString(strings[this.number]);
@@ -933,7 +934,7 @@ IString.prototype = {
933934
// this is default case
934935
defaultCase = new IString(strings[i]);
935936
} else {
936-
var limitsArr = (limits[i].indexOf(",") > -1) ? limits[i].split(",") : [limits[i]];
937+
limitsArr = (limits[i].indexOf(",") > -1) ? limits[i].split(",") : [limits[i]];
937938

938939
var applicable = true;
939940
for (var j = 0; applicable && j < args.length && j < limitsArr.length; j++) {

js/lib/JSUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ JSUtils.merge = function (object1, object2, replace, name1, name2) {
236236
newObj[prop] = JSUtils.merge(object1[prop], object2[prop], replace);
237237
} else {
238238
// for debugging. Used to determine whether or not json files are overriding their parents unnecessarily
239-
if (name1 && name2 && newObj[prop] == object2[prop]) {
239+
if (name1 && name2 && newObj[prop] === object2[prop]) {
240240
console.log("Property " + prop + " in " + name1 + " is being overridden by the same value in " + name2);
241241
}
242242
newObj[prop] = object2[prop];

js/lib/ListFmt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ ListFmt.prototype.format = function(items) {
180180

181181
} else {
182182
for(i = itemCount; i >= 0 ; i--){
183-
if (i == itemCount) {
183+
if (i === itemCount) {
184184
formattedList = endFmt.replace("{0}", items[itemCount-2]).replace("{1}", items[itemCount-1]);
185185
i = i-2;
186-
} else if (i == 0) {
186+
} else if (i === 0) {
187187
formattedList = startFmt.replace("{0}",items[i]).replace("{1}", formattedList);
188188
}
189189
else {

js/lib/Loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Loader.prototype._loadFileAlongIncludePath = function(includePath, pathname) {
7777

7878
if (text) {
7979

80-
if (typeof (this.isMultiPaths) != "undefined" && this.isMultiPaths == true){
80+
if (typeof (this.isMultiPaths) !== "undefined" && this.isMultiPaths === true){
8181
if (typeof(text) === "string") {
8282
text = JSON.parse(text);
8383
}

js/lib/MathUtils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ MathUtils.halfodd = function (num) {
129129
* @return the remainder of dividing the dividend by the modulus.
130130
*/
131131
MathUtils.mod = function (dividend, modulus) {
132-
if (modulus == 0) {
132+
if (modulus === 0) {
133133
return 0;
134134
}
135135
var x = dividend % modulus;
@@ -151,7 +151,7 @@ MathUtils.mod = function (dividend, modulus) {
151151
* @return the remainder of dividing the dividend by the modulus.
152152
*/
153153
MathUtils.amod = function (dividend, modulus) {
154-
if (modulus == 0) {
154+
if (modulus === 0) {
155155
return 0;
156156
}
157157
var x = dividend % modulus;

js/lib/MeasurementFactory.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ var MeasurementFactory = function(options) {
120120
}
121121

122122
var measurement, measure = undefined;
123-
123+
var c;
124124
// first try in the existing case
125-
for (var c in Measurement._constructors) {
125+
for (c in Measurement._constructors) {
126126
measurement = Measurement._constructors[c];
127127
if (Measurement.getUnitId(measurement, options.unit)) {
128128
measure = c;
@@ -133,7 +133,7 @@ var MeasurementFactory = function(options) {
133133
if (!measure) {
134134
// if it wasn't found before, try again in lower case -- this may recognize incorrectly because some
135135
// units can differ only in their case like "mm" and "Mm"
136-
for (var c in Measurement._constructors) {
136+
for (c in Measurement._constructors) {
137137
measurement = Measurement._constructors[c];
138138
if (typeof(Measurement.getUnitIdCaseInsensitive(measurement, options.unit)) !== 'undefined') {
139139
measure = c;

0 commit comments

Comments
 (0)