(target: T[], insertIndex: number, insertArr: T[])
| 502 | * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array |
| 503 | */ |
| 504 | export function arrayInsert<T>(target: T[], insertIndex: number, insertArr: T[]): T[] { |
| 505 | const before = target.slice(0, insertIndex); |
| 506 | const after = target.slice(insertIndex); |
| 507 | return before.concat(insertArr, after); |
| 508 | } |
| 509 | |
| 510 | /** |
| 511 | * Uses Fisher-Yates shuffle to shuffle the given array |