-
-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathArrayConcat.ts
More file actions
22 lines (21 loc) · 597 Bytes
/
ArrayConcat.ts
File metadata and controls
22 lines (21 loc) · 597 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
export function __TS__ArrayConcat<T>(this: T[], ...items: Array<T | T[]>): T[] {
const result: T[] = [];
let len = 0;
for (const i of $range(1, this.length)) {
len++;
result[len - 1] = this[i - 1];
}
for (const i of $range(1, items.length)) {
const item = items[i - 1];
if (Array.isArray(item)) {
for (const j of $range(1, item.length)) {
len++;
result[len - 1] = item[j - 1];
}
} else {
len++;
result[len - 1] = item;
}
}
return result;
}