Skip to content

Commit 8fb7b70

Browse files
Merge branch 'main' into feat-multi-api
2 parents 1b9b4bb + 4490e0a commit 8fb7b70

File tree

1 file changed

+12
-0
lines changed
  • src/components/ParserOpenRPC/InteractiveBox

1 file changed

+12
-0
lines changed

src/components/ParserOpenRPC/InteractiveBox/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,23 @@ function sortObjectKeysByArray(
5757
return result;
5858
}
5959

60+
function removeEmptyStrings(obj) {
61+
for (const key in obj) {
62+
if (obj[key] === "") {
63+
delete obj[key];
64+
}
65+
}
66+
return obj;
67+
}
68+
6069
function removeEmptyArrays(obj: any, params: any[]) {
6170
const newObj = JSON.parse(JSON.stringify(obj));
6271
for (const key in newObj) {
6372
const currentParam = params.find(item => item.name === key)
6473
if (newObj.hasOwnProperty(key)) {
74+
if (!Array.isArray(newObj[key]) && typeof newObj[key] === "object") {
75+
newObj[key] = removeEmptyStrings(newObj[key]);
76+
}
6577
if (currentParam && currentParam.required) {
6678
return newObj
6779
}

0 commit comments

Comments
 (0)