-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
80 lines (72 loc) · 1.55 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// const adminPaths2 = [
// {
// name: 'Dashboard',
// path: 'dashboard',
// element: 'ADMIN_DASHBOARD',
// },
// {
// name: 'User Management',
// children: [
// {
// name: 'Create Admin',
// path: 'create-admin',
// element: 'CREATE_ADMIN',
// },
// {
// name: 'Create Faculty',
// path: 'create-faculty',
// element: 'CREATE_FACULTY',
// },
// {
// name: 'Create Student',
// path: 'create-student',
// element: 'CREATE_STUDENT',
// },
// ],
// },
// ];
// const newArray = adminPaths2.reduce((acc, item) => {
// if (item.path && item.name) {
// acc.push({
// key: item.name,
// label: 'NAVLINK',
// });
// }
// if (item.children) {
// acc.push({
// key: item.name,
// label: item.name,
// children: item.children.map((child) => ({
// key: child.name,
// label: 'NAVLINK',
// })),
// });
// }
// return acc;
// }, []);
// const newArray = adminPaths2.reduce((acc, item) => {
// if (item.path && item.element) {
// acc.push({
// path: item.path,
// element: item.element,
// });
// }
// if (item.children) {
// item.children.forEach((child) => {
// acc.push({
// path: child.path,
// element: child.element,
// });
// });
// }
// return acc;
// }, []);
const obj = {
name: 'Mezba',
role: 'mentor',
age: 18,
greet: () => {
return 'Hello World';
},
};
console.log(JSON.stringify(obj));