From aca7190f0854384989a1e2260af5b7ca65e9f928 Mon Sep 17 00:00:00 2001 From: Rafael Bardini Date: Mon, 4 Oct 2021 21:05:51 +0200 Subject: [PATCH] feat(projects): format language-sensitive lists --- index.js | 4 ++-- tap-snapshots/test/render.js.test.cjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 057bfdc..b3b2078 100644 --- a/index.js +++ b/index.js @@ -46,8 +46,8 @@ Handlebars.registerHelper('icon', (name, fallback) => }), ) -Handlebars.registerHelper('join', (arr, separator) => - arr.join(typeof separator === 'string' ? separator : ', '), +Handlebars.registerHelper('join', arr => + Intl.ListFormat ? new Intl.ListFormat('en').format(arr) : arr.join(', '), ) Handlebars.registerHelper('markdown', doc => micromark(doc)) diff --git a/tap-snapshots/test/render.js.test.cjs b/tap-snapshots/test/render.js.test.cjs index 88a5ce6..1243cb0 100644 --- a/tap-snapshots/test/render.js.test.cjs +++ b/tap-snapshots/test/render.js.test.cjs @@ -386,7 +386,7 @@ blockquote > * + * { - Team lead, Designer + Team lead and Designer at Smoogle