File size: 256 Bytes
bc20498
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
/**
 * @param {string[]} items
 * @param {string} [conjunction]
 */
export default function list(items, conjunction = 'or') {
	if (items.length === 1) return items[0];
	return `${items.slice(0, -1).join(', ')} ${conjunction} ${items[items.length - 1]}`;
}