parent
92aae86664
commit
879038ee0b
@ -0,0 +1,7 @@
|
||||
export default function shortenList(input, startCount = 3, endCount = 1, separator = ', ') {
|
||||
const sorted = [...input].sort();
|
||||
if (sorted.length <= startCount + endCount) {
|
||||
return sorted.join(separator);
|
||||
}
|
||||
return [...sorted.slice(0, startCount), '...', sorted.slice(-endCount)].join(separator);
|
||||
}
|
Loading…
Reference in new issue