mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
7 lines
309 B
JavaScript
7 lines
309 B
JavaScript
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);
|
|
}
|