chore: modify getAllPaths utility method to only create child records for native objects (#21998)
This commit is contained in:
parent
977eda6388
commit
f45afd9c8f
|
|
@ -205,6 +205,7 @@ describe("1. Correctly handle paths", () => {
|
||||||
["1", "2"],
|
["1", "2"],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
stringProperty: new String("Hello"),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const result = {
|
const result = {
|
||||||
|
|
@ -221,6 +222,7 @@ describe("1. Correctly handle paths", () => {
|
||||||
"WidgetName.objectProperty.childObjectProperty[3]": true,
|
"WidgetName.objectProperty.childObjectProperty[3]": true,
|
||||||
"WidgetName.objectProperty.childObjectProperty[3][0]": true,
|
"WidgetName.objectProperty.childObjectProperty[3][0]": true,
|
||||||
"WidgetName.objectProperty.childObjectProperty[3][1]": true,
|
"WidgetName.objectProperty.childObjectProperty[3][1]": true,
|
||||||
|
"WidgetName.stringProperty": true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const actual = getAllPaths(myTree);
|
const actual = getAllPaths(myTree);
|
||||||
|
|
|
||||||
|
|
@ -491,7 +491,7 @@ export const getAllPaths = (
|
||||||
const tempKey = curKey ? `${curKey}[${i}]` : `${i}`;
|
const tempKey = curKey ? `${curKey}[${i}]` : `${i}`;
|
||||||
getAllPaths(records[i], tempKey, result);
|
getAllPaths(records[i], tempKey, result);
|
||||||
}
|
}
|
||||||
} else if (typeof records === "object" && records) {
|
} else if (isTrueObject(records)) {
|
||||||
for (const key of Object.keys(records)) {
|
for (const key of Object.keys(records)) {
|
||||||
const tempKey = curKey ? `${curKey}.${key}` : `${key}`;
|
const tempKey = curKey ? `${curKey}.${key}` : `${key}`;
|
||||||
getAllPaths(records[key], tempKey, result);
|
getAllPaths(records[key], tempKey, result);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user