(names)
| 50 | |
| 51 | // Optimized namespace builder using plain objects instead of globalThis |
| 52 | function createNamespaceTree(names) { |
| 53 | names = Array.isArray(names) ? names : names.split('.'); |
| 54 | |
| 55 | const root = {}; |
| 56 | let current = root; |
| 57 | |
| 58 | for (const name of names) { |
| 59 | if (!current[name]) { |
| 60 | current[name] = {}; |
| 61 | } |
| 62 | current = current[name]; |
| 63 | } |
| 64 | |
| 65 | return root; |
| 66 | } |
| 67 | |
| 68 | function getNamespace(tree, names) { |
| 69 | names = Array.isArray(names) ? names : names.split('.'); |