summaryrefslogtreecommitdiff
path: root/src/compiler/utils/list.ts
blob: ba1ef9f4c03aa30b3ec5387f00414ba9b3297175 (plain) (blame)
1
2
3
4
export default function list(items: string[], conjunction = 'or') {
  if (items.length === 1) return items[0];
  return `${items.slice(0, -1).join(', ')} ${conjunction} ${items[items.length - 1]}`;
}