I've created a site in enduro and I wrote a few helpers that relay on options.fn and options.inverse. Everything works fine when I start the server (development and production mode), but when the content gets updated in the cms/* folder, helper instead of an usual content (helper works on if/else principle) returns a string "[Object]".
Is this caused by my helpers or the enduro itself has a bug? Any ideas would be welcomed.
Node version: v8.11.1
enduro version: 1.4.46
Helper code:
function compare(a, operator, b, options) {
if (arguments.length < 4) {
throw new Error('handlebars Helper {{compare}} expects 4 arguments');
}
var result;
switch (operator) {
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 '>':
result = a > b;
break;
case '<=':
result = a <= b;
break;
case '>=':
result = a >= b;
break;
case 'typeof':
result = typeof a === b;
break;
default: {
throw new Error('helper {{compare}}: invalid operator: `' + operator + '`');
}
}
if (result) {
return options.fn(this);
} else {
return options.inverse(this);
}
};
enduro.templating_engine.registerHelper("compare", compare);
I've created a site in enduro and I wrote a few helpers that relay on
options.fn
andoptions.inverse
. Everything works fine when I start the server (development and production mode), but when the content gets updated in the cms/* folder, helper instead of an usual content (helper works on if/else principle) returns a string "[Object]".Is this caused by my helpers or the enduro itself has a bug? Any ideas would be welcomed.
Node version: v8.11.1 enduro version: 1.4.46