diff --git a/src/handlebars.ts b/src/handlebars.ts index 9a728722..78f327f9 100644 --- a/src/handlebars.ts +++ b/src/handlebars.ts @@ -8,6 +8,7 @@ Handlebars.registerHelper('truncate', (text, size) => text.substring(0, size)) Handlebars.registerHelper('default', (want, fallback) => (want || want === 0 || want === false ? want : fallback)) Handlebars.registerHelper('pluralize', (items, ...args) => { + items = items ?? [] const count = typeof items === 'number' ? items : items.length const singular = args.length === 1 ? 'item' : args[0] const plural = args.length === 3 ? args[1] : `${singular}s`