Handlebars.registerHelper("compare", function(a, operator, b) {
var result = false;
try {
switch (operator) {
case "==":
// eslint-disable-next-line eqeqeq
result = a == b;
break;
case "===":
result = a === b;
break;
case "!=":
// eslint-disable-next-line eqeqeq
result = a != b;
break;
case "!==":
result = a !== b;
break;
case "<":
result = a < b;
break;
case ">":
result = a > b;
break;
case "<=":
result = a <= b;
break;
case ">=":
result = a >= b;
break;
case "typeof":
// eslint-disable-next-line valid-typeof
result = typeof a === b;
break;
default: {
throw new Error(
"helper {{compare}}: invalid operator: ' + ".concat(operator, " + '")
);
}
}
} catch (err) {
console.error("\n********** ".concat(err, "."));
}
return result;
});