diff --git a/js/src/utils/listFormat.ts b/js/src/utils/listFormat.ts index 47cb20787..c4cb3b508 100644 --- a/js/src/utils/listFormat.ts +++ b/js/src/utils/listFormat.ts @@ -8,10 +8,16 @@ const shortDisjunctionFormatter = new Intl.ListFormat(undefined, { type: "disjunction", }); +const listFormatAvailable = typeof Intl?.ListFormat === "function"; + export const listShortConjunctionFormatter = (list: Array): string => { - return shortConjunctionFormatter.format(list); + return listFormatAvailable + ? shortConjunctionFormatter.format(list) + : list.join(","); }; export const listShortDisjunctionFormatter = (list: Array): string => { - return shortDisjunctionFormatter.format(list); + return listFormatAvailable + ? shortDisjunctionFormatter.format(list) + : list.join(","); };