Skip to content

Commit

Permalink
clone json obj in relay flight client host config parser
Browse files Browse the repository at this point in the history
  • Loading branch information
lunaruan committed Dec 15, 2020
1 parent 604bbcd commit f4f2f41
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,25 @@ function parseModelRecursively(response: Response, parentObj, value) {
}
if (typeof value === 'object' && value !== null) {
if (Array.isArray(value)) {
const parsedValue = [];
for (let i = 0; i < value.length; i++) {
(value: any)[i] = parseModelRecursively(response, value, value[i]);
(parsedValue: any)[i] = parseModelRecursively(
response,
value,
value[i],
);
}
return parseModelTuple(response, value);
return parseModelTuple(response, parsedValue);
} else {
const parsedValue = {};
for (const innerKey in value) {
(value: any)[innerKey] = parseModelRecursively(
(parsedValue: any)[innerKey] = parseModelRecursively(
response,
value,
value[innerKey],
);
}
return parsedValue;
}
}
return value;
Expand Down

0 comments on commit f4f2f41

Please sign in to comment.