@restorecommerce/handlebars-helperized
Version:
Opinionated handlebars based templating engine for rendering e-mail like content
12 lines (9 loc) • 339 B
text/typescript
let customHandlebarsExtensions = (hbs: any, opts: any) => {
// increment a given numerical string by one
hbs.registerHelper('increment', (value: any, hash: any) => {
const toIncrement = parseInt(value, 10);
if (isNaN(toIncrement)) return '0';
return toIncrement + 1;
});
};
module.exports = customHandlebarsExtensions;