change talent

This commit is contained in:
Vick Scarlet
2021-08-19 13:08:44 +08:00
parent 9aa9e3fe2d
commit 803a1a4438
10 changed files with 165 additions and 127 deletions

View File

@@ -36,7 +36,13 @@ async function transform(filePath) {
if(!temp[subKey]) temp[subKey] = {};
temp = temp[subKey];
}
temp[lastKey] = cell;
if(lastKey.includes('[]')) {
const aKey = lastKey.split('[]')[0];
if(!temp[aKey]) temp[aKey] = [cell];
else temp[aKey].push(cell);
} else {
temp[lastKey] = cell;
}
} else if(key.includes('[]')) {
const aKey = key.split('[]')[0];
if(!rowData[aKey]) rowData[aKey] = [cell];