|
8 | 8 | */ |
9 | 9 | const weakSet = new WeakSet(); |
10 | 10 | const pathRouter = ["root"]; |
| 11 | +const regexp = /以熔体流动速率/; |
11 | 12 |
|
12 | 13 | const deepScanObject = (origin, deep, maxDeep) => { |
13 | 14 | if (deep > maxDeep) return; |
| 15 | + if (origin instanceof Map) { |
| 16 | + weakSet.add(origin); |
| 17 | + if (weakSet.has(origin)) return; |
| 18 | + origin = [...origin.entries()]; |
| 19 | + } |
14 | 20 | for (const item in origin) { |
| 21 | + const currentPath = pathRouter.join("/") + "/" + item; |
15 | 22 | try { |
16 | 23 | const value = origin[item]; |
| 24 | + if ( |
| 25 | + value instanceof Node || |
| 26 | + value instanceof Window || |
| 27 | + item.includes("_react") || |
| 28 | + item.includes("cssRule") |
| 29 | + ) { |
| 30 | + continue; |
| 31 | + } |
17 | 32 | if (value && typeof value === "object") { |
18 | | - if (weakSet.has(value)) continue; |
| 33 | + if (weakSet.has(value)) { |
| 34 | + regexp.test(item) && console.log(currentPath); |
| 35 | + continue; |
| 36 | + } |
19 | 37 | weakSet.add(value); |
20 | 38 | pathRouter.push(item); |
21 | 39 | deepScanObject(value, deep + 1, maxDeep); |
22 | 40 | pathRouter.pop(); |
23 | 41 | } else { |
24 | | - const regexp = /以熔体流动速率/; |
25 | 42 | if (regexp.test(item) || regexp.test(value)) { |
26 | | - console.log(pathRouter.join("/") + "/" + item, "================", value); |
| 43 | + console.log(currentPath, "================", value); |
27 | 44 | } |
28 | 45 | } |
29 | 46 | } catch (e) { |
|
0 commit comments