mirror of
https://github.com/unanmed/ginka-generator.git
synced 2026-05-14 04:41:12 +08:00
feat: 数据集 id 避免嵌套堆叠
This commit is contained in:
parent
cc2fc3e96c
commit
ad2715cd59
@ -20,11 +20,18 @@ export function mergeDataset<T>(
|
||||
if (datasets.length === 1) {
|
||||
return datasets[0];
|
||||
}
|
||||
const usedKeys = new Set<string>();
|
||||
const data: Record<string, T> = {};
|
||||
datasets.forEach(v => {
|
||||
for (const [key, value] of Object.entries(v.data)) {
|
||||
const dataKey = `${v.datasetId}/${key}`;
|
||||
data[dataKey] = value;
|
||||
if (usedKeys.has(key)) {
|
||||
const dataKey = `${v.datasetId}/${key}`;
|
||||
data[dataKey] = value;
|
||||
usedKeys.add(dataKey);
|
||||
} else {
|
||||
data[key] = value;
|
||||
usedKeys.add(key);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user