MCPcopy Create free account
hub / github.com/baiwumm/react-admin / recursive

Function recursive

Xmw_server/src/utils/index.ts:74–89  ·  view source on GitHub ↗
(obj: XmwInternational, serilKey = '')

Source from the content-addressed store, hash-verified

72 const resourceItem = resource[i];
73 // 递归函数
74 function recursive(obj: XmwInternational, serilKey = '') {
75 // 拼接对象名
76 let pKey = serilKey;
77 pKey += pKey ? `.${obj[name]}` : obj[name];
78 // 当前层级是否有数据,给 result 赋值
79 if (obj[lang]) {
80 result[pKey] = obj[lang];
81 }
82 // 判断是否有子级,有就递归遍历
83 if (obj.children?.length && Array.isArray(obj.children)) {
84 for (let j = 0; j < obj.children.length; j++) {
85 const child = obj.children[j];
86 recursive(child, pKey);
87 }
88 }
89 }
90 // 循环执行
91 recursive(resourceItem);
92 }

Callers 1

initializeLangFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected