|
|
@ -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 };
|
|
|
|