bugfix in fn merge_tables

pull/5428/head
Milan Hauth 5 years ago
parent e76f37d8a8
commit b7d5974a51

@ -59,14 +59,16 @@ function merge_tables<T>(
): { table: T[]; new_idx: number[] } { ): { table: T[]; new_idx: number[] } {
const table = original.slice(); const table = original.slice();
const new_idx = []; const new_idx = [];
for (let j = 0; j < original.length; j++) { if (extended) {
const current = extended[j]; for (let j = 0; j < extended.length; j++) {
const existing = table.indexOf(current); const current = extended[j];
if (existing < 0) { const existing = table.indexOf(current);
table.push(current); if (existing == -1) {
new_idx[j] = table.length - 1; table.push(current);
} else { new_idx[j] = table.length - 1;
new_idx[j] = existing; } else {
new_idx[j] = existing;
}
} }
} }
return { table, new_idx }; return { table, new_idx };

Loading…
Cancel
Save