You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nucleus/src/utils/listToAndMore.ts

7 lines
243 B

export default (list: string[], max: number) => {
// PineappleFan, Coded, Mini (and 10 more)
if(list.length > max) {
return list.slice(0, max).join(", ") + ` (and ${list.length - max} more)`;
}
return list.join(", ");
}