Skip to content

Commit

Permalink
fix logic for processing default config
Browse files Browse the repository at this point in the history
  • Loading branch information
mfshao committed Dec 12, 2024
1 parent 45d228d commit d9674c3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions data/getTexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function doStringify(value, variables, indent = 0, spaces = 0) {
const objs = value.map(
(item) => `${insertSpace(indent + spaces)}${doStringify(item, variables, indent + spaces, spaces)}`,
).join(`,${ending}`);
// console.log(doWrapping(objs, '[', ']', indent, spaces));
return doWrapping(objs, '[', ']', indent, spaces);
}
if (typeof value === 'string') {
Expand Down Expand Up @@ -109,8 +110,14 @@ function buildConfig(appIn, data) {
if (typeof result[k] === 'object') {
const defaultVal = defaultConfig[k];
const appVal = appConfig[k];
if (defaultVal && appVal && typeof defaultVal === 'object' && typeof appVal === 'object') {
result[k] = { ...defaultVal, ...appVal };
if (defaultVal && appVal) {
if (typeof defaultVal === 'object' && typeof appVal === 'object') {
if (Array.isArray(defaultVal) && Array.isArray(appVal)) {
result[k] = defaultVal.concat(appVal);
} else if (!Array.isArray(defaultVal) && !Array.isArray(appVal)) {
result[k] = { ...defaultVal, ...appVal };
}
}
}
}
},
Expand Down

0 comments on commit d9674c3

Please sign in to comment.