Skip to content

Commit

Permalink
update or helper handler
Browse files Browse the repository at this point in the history
  • Loading branch information
btkostner committed Oct 17, 2023
1 parent f1094f4 commit 6febc92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/handlebars.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import Handlebars from "handlebars";
import isObject from "lodash/isObject";

Handlebars.registerHelper("or", function (context, ...params) {
Handlebars.registerHelper("or", function (...params) {
const options = params[params.length - 1];
params.pop();

for (const value of params) {
if (value) {
return options.fn(context);
return options.fn();
}
}

return options.inverse(context);
return options.inverse();
});

export default Handlebars;

0 comments on commit 6febc92

Please sign in to comment.