The weeb for the next gen discord boat - Wamellow
wamellow.com
bot
discord
1export function toFixedArrayLength<T>(arr: T[], length: number): T[] {
2 if (!arr.length) return [];
3
4 const numCopies = Math.ceil(length / arr.length);
5 const slicedArray: T[] = [];
6
7 for (let i = 0; i < numCopies; i++) {
8 slicedArray.push(...arr);
9 }
10
11 return slicedArray.slice(0, length);
12}