Based on https://stackoverflow.com/a/31632215/761771
const reduceOp = function(args, reducer){
args = Array.from(args);
args.pop(); // => options
var first = args.shift();
return args.reduce(reducer, first);
};
handlebars.registerHelper({
eq : function(){ return reduceOp(arguments, (a,b) => a === b); },
ne : function(){ return reduceOp(arguments, (a,b) => a !== b); },
lt : function(){ return reduceOp(arguments, (a,b) => a < b); },
gt : function(){ return reduceOp(arguments, (a,b) => a > b); },
lte : function(){ return reduceOp(arguments, (a,b) => a <= b); },
gte : function(){ return reduceOp(arguments, (a,b) => a >= b); },
and : function(){ return reduceOp(arguments, (a,b) => a && b); },
or : function(){ return reduceOp(arguments, (a,b) => a || b); },
});
{{#if (or
(eq section1 "foo")
(ne section2 "bar"))}}
.. content
{{/if}}
{{#if (or condA condB condC)}}
.. content
{{/if}}
Thank you.