blob: 671311a233bf4ac71bc9c96674caa381f1cb5c0d (
plain) (
blame)
1
2
3
4
5
|
/** Display an array of strings in a human-readable format */
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]}`;
}
|