Improve readability of code
This commit is contained in:
@@ -7,7 +7,7 @@ function compare(a, b, operator) {
|
|||||||
let logMsg = '';
|
let logMsg = '';
|
||||||
let returnValue = undefined;
|
let returnValue = undefined;
|
||||||
try {
|
try {
|
||||||
logMsg = 'Quantity comparison of ' + a + ', ' + b + ' with operator ' + operator;
|
logMsg = `Quantity comparison of ${a}, ${b} with operator ${operator}`;
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case '==':
|
case '==':
|
||||||
returnValue = a.equal(b);
|
returnValue = a.equal(b);
|
||||||
@@ -29,7 +29,7 @@ function compare(a, b, operator) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
logMsg = 'Standard comparison of ' + a + ', ' + b + ' with operator ' + operator;
|
logMsg = `Standard comparison of ${a}, ${b} with operator ${operator}`;
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case '==':
|
case '==':
|
||||||
returnValue = (a == b);
|
returnValue = (a == b);
|
||||||
@@ -53,7 +53,7 @@ function compare(a, b, operator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (returnValue == undefined) {
|
if (returnValue == undefined) {
|
||||||
console.error('No valid operator provided');
|
console.error(`${operator} is no valid operator`);
|
||||||
} else {
|
} else {
|
||||||
console.debug(logMsg);
|
console.debug(logMsg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user