(obj: any)
| 1277 | }; |
| 1278 | |
| 1279 | export function deepTraverseAndModify(obj: any): any { |
| 1280 | if (Array.isArray(obj)) { |
| 1281 | return obj.map(deepTraverseAndModify); |
| 1282 | } else if (typeof obj === "object" && obj !== null) { |
| 1283 | const newObj: any = {}; |
| 1284 | |
| 1285 | for (const [key, value] of Object.entries(obj)) { |
| 1286 | if ( |
| 1287 | key === "computedViewTreeNode" && |
| 1288 | value && |
| 1289 | typeof value === "object" && |
| 1290 | "id" in value |
| 1291 | ) { |
| 1292 | newObj["computedViewTreeNodeId"] = value.id; |
| 1293 | } else if ( |
| 1294 | key === "internalMetadata" && |
| 1295 | value && |
| 1296 | typeof value === "object" && |
| 1297 | "id" in value |
| 1298 | ) { |
| 1299 | let x = value as unknown as { component: any; id: string }; |
| 1300 | newObj["internalMetadataName+Id"] = ( |
| 1301 | x.component.tagName + |
| 1302 | x.component.name + |
| 1303 | "-" + |
| 1304 | x.id.slice(0, 4) |
| 1305 | ).replace("undefined", ""); |
| 1306 | } else { |
| 1307 | newObj[key] = deepTraverseAndModify(value); |
| 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | return newObj; |
| 1312 | } |
| 1313 | |
| 1314 | return obj; |
| 1315 | } |
| 1316 | |
| 1317 | export const buildReactTrees = ( |
| 1318 | rootComponentInternalMetadata: ReactComponentInternalMetadata |
nothing calls this directly
no outgoing calls
no test coverage detected