mirror of https://github.com/sveltejs/svelte
Part of #4694 Also related: https://github.com/Rich-Harris/code-red/pull/71pull/7203/head
parent
d1b3f462a5
commit
7f4d0cda74
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Pushes all `items` into `array` using `push`, therefore mutating the array.
|
||||
* We do this for memory and perf reasons, and because `array.push(...items)` would
|
||||
* run into a "max call stack size exceeded" error with too many items (~65k).
|
||||
* @param array
|
||||
* @param items
|
||||
*/
|
||||
export function push_array<T>(array: T[], items: T[]): void {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
array.push(items[i]);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue