Skip to content

Commit

Permalink
NS-98
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolinaFilipiuk committed Nov 16, 2020
1 parent c8754de commit b31e9e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions nurse-scheduling-problem-frontend
Submodule nurse-scheduling-problem-frontend added at 59ef3a
16 changes: 8 additions & 8 deletions src/helpers/array.helper.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export class ArrayHelper {
public static zip<T>(array1: T[], array2: T[]): [T, T][] {
let longer: T[];
let shorter: T[];
if (array1.length >= array2.length) {
[longer, shorter] = [array1, array2];
} else {
[longer, shorter] = [array2, array1];
public static zip<T1, T2>(
array1: (T1 | null)[],
array2: (T2 | null)[]
): [T1 | null, T2 | null][] {
if (array1.length < array2.length) {
const count = array2.length - array1.length;
array1.fill(null);
}
return longer.map((v: T, index: number) => [v, shorter[index]]);
return array1.map((v, index: number) => [v, array2[index]]);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit b31e9e0

Please sign in to comment.