summaryrefslogtreecommitdiff
path: root/src/compiler/utils/list.ts
blob: 785f006d196edbbb8d5b5863ef1a67ed3a2b92b1 (plain) (blame)
1
2
3
4
5
6
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
	]}`;
}