MCPcopy Create free account
hub / github.com/chunshand/qdev / recursion

Function recursion

admin/src/components/Qdev/Form/interface.ts:89–106  ·  view source on GitHub ↗
(_arr: any[])

Source from the content-addressed store, hash-verified

87 isTree: true,
88 }
89 function recursion(_arr: any[]) {
90 let arr: any[] = [];
91 for (let i in _arr) {
92 let item = _arr[i];
93 let obj: any = {
94 id: item[props.id],
95 label: item[props.label],
96 value: item[props.value],
97 children: [],
98 meta: item
99 }
100 if (item[props.children] && props.isTree) {
101 obj[props.children] = recursion(item[props.children]);
102 }
103 arr.push(obj)
104 }
105 return arr;
106 }
107 const options = params.recursion ? params.recursion(res.data) : recursion(res.data)
108 find.options = options
109 // eslint-disable-line

Callers 1

setOptionsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected