(allocatedSize: number, empty: Partial<Cube>, cubes: Cube[])
| 3 | import { Cube } from './interfaces'; |
| 4 | |
| 5 | export function patchCubeArray(allocatedSize: number, empty: Partial<Cube>, cubes: Cube[]) { |
| 6 | const patched: Cube[] = new Array<Cube>(allocatedSize); |
| 7 | patched.fill(empty as Cube); |
| 8 | |
| 9 | cubes.forEach(cube => patched[cube.ordinal] = cube); |
| 10 | |
| 11 | return patched; |
| 12 | } |