MCPcopy Create free account
hub / github.com/neomjs/neo / createNamespaceTree

Function createNamespaceTree

buildScripts/docs/jsdocx.mjs:52–66  ·  view source on GitHub ↗
(names)

Source from the content-addressed store, hash-verified

50
51// Optimized namespace builder using plain objects instead of globalThis
52function 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
68function getNamespace(tree, names) {
69 names = Array.isArray(names) ? names : names.split('.');

Callers

nothing calls this directly

Calls 2

isArrayMethod · 0.80
splitMethod · 0.80

Tested by

no test coverage detected