MCPcopy Create free account
hub / github.com/buqiyuan/react-antd-admin / flatArrayObject

Function flatArrayObject

src/utils/index.ts:19–30  ·  view source on GitHub ↗
(list: any[], keys: string[], arr: T[] = [])

Source from the content-addressed store, hash-verified

17 * @returns
18 */
19export const flatArrayObject = <T = any>(list: any[], keys: string[], arr: T[] = []): T[] => {
20 list.forEach(item => {
21 keys.forEach(key => {
22 if (Array.isArray(item[key])) {
23 flatArrayObject(item[key], keys, arr);
24 } else {
25 arr.push({ ...item });
26 }
27 });
28 });
29 return arr;
30};

Callers 1

generateRoutesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected