re-factor / cleanup

This commit is contained in:
2022-01-11 22:08:38 +00:00
parent e871708b20
commit e0be8a7cfe
251 changed files with 14680 additions and 15693 deletions

View File

@@ -118,7 +118,7 @@ export default {
removeAllPropertiesFromObject: function(o) {
for (let variableKey in o) {
if (o.hasOwnProperty(variableKey)) {
if (Object.prototype.hasOwnProperty.call(o, variableKey)) {
delete o[variableKey];
}
}
@@ -136,7 +136,7 @@ export default {
if (
!key.endsWith("Viz") &&
!skipNames.some(x => x == key) &&
source.hasOwnProperty(key)
Object.prototype.hasOwnProperty.call(source, key)
) {
o[key] = source[key];
}
@@ -201,7 +201,7 @@ export default {
// ROUNDING
// //https://medium.com/swlh/how-to-round-to-a-certain-number-of-decimal-places-in-javascript-ed74c471c1b8
roundAccurately: function(number, decimalPlaces) {
if (!number || number == 0 || number == NaN) {
if (!number || number == 0 || Number.isNaN(number)) {
return number;
}
const wasNegative = number < 0;
@@ -300,7 +300,7 @@ export default {
//A number already then parse and return
if (this.isNumeric(string)) {
if (string === NaN) {
if (Number.isNaN(string)) {
return 0;
}
return parseFloat(string);
@@ -312,7 +312,7 @@ export default {
}
const ret = parseFloat(string.replace(/[^\d.-]/g, ""));
if (ret == NaN) {
if (Number.isNaN(ret)) {
return 0;
}
@@ -324,7 +324,7 @@ export default {
//
isNegative: function(v) {
//null or empty then zero
if (!v || v == 0 || v == NaN) {
if (!v || v == 0 || Number.isNaN(v)) {
return false;
}
return parseFloat(v) < 0;
@@ -943,25 +943,25 @@ export default {
const ret = [];
//turn EXCLUDE selected gzDaysOfWeek into INCLUDE selected days for vCalendar
if (!!!(dow & 64)) {
if (!(dow & 64)) {
ret.push(0);
}
if (!!!(dow & 1)) {
if (!(dow & 1)) {
ret.push(1);
}
if (!!!(dow & 2)) {
if (!(dow & 2)) {
ret.push(2);
}
if (!!!(dow & 4)) {
if (!(dow & 4)) {
ret.push(3);
}
if (!!!(dow & 8)) {
if (!(dow & 8)) {
ret.push(4);
}
if (!!!(dow & 16)) {
if (!(dow & 16)) {
ret.push(5);
}
if (!!!(dow & 32)) {
if (!(dow & 32)) {
ret.push(6);
}
return ret;