for look index namings (consistency) (#1183)

This commit is contained in:
Jaco
2021-11-14 19:22:06 +02:00
committed by GitHub
parent 36f6407796
commit e93f8d7418
5 changed files with 11 additions and 11 deletions
+3 -3
View File
@@ -19,10 +19,10 @@ export function arrayChunk <T> (array: T[], chunkSize: number): T[][] {
const outputSize = Math.ceil(array.length / chunkSize);
const output = Array<T[]>(outputSize);
for (let index = 0; index < outputSize; index++) {
const offset = index * chunkSize;
for (let i = 0; i < outputSize; i++) {
const offset = i * chunkSize;
output[index] = array.slice(offset, offset + chunkSize);
output[i] = array.slice(offset, offset + chunkSize);
}
return output;
+2 -2
View File
@@ -27,12 +27,12 @@ export function arrayFlatten <T> (arrays: T[][]): T[] {
}
const output = new Array<T>(size);
let index = -1;
let i = -1;
for (const a of arrays) {
// instead of pushing, we just set the entries
for (let e = 0; e < a.length; e++) {
output[++index] = a[e];
output[++i] = a[e];
}
}