File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
const express = require ( "express" ) ;
2
2
const router = express . Router ( ) ;
3
- const graph = require ( "../graph" ) ;
3
+ const { $ : graph } = require ( "../graph" ) ;
4
4
5
5
router . get ( "/graph" , ( req , res ) => {
6
6
const result = { } ;
7
7
8
8
for ( const key in graph ) {
9
9
const node = graph [ key ] ;
10
10
11
- if ( node . id && node . key ) {
11
+ if ( node . key ) {
12
12
result [ node . key ] = node ;
13
13
14
14
const tmp = {
15
- id : node . id ,
15
+ id : node . key ,
16
16
type : node . constructor . name ,
17
17
} ;
18
18
19
19
for ( const prop in node ) {
20
20
const object = node [ prop ] ;
21
21
22
- if ( typeof object === "object" && object ?. id ) {
23
- tmp [ prop ] = object . id ;
24
- } else if ( typeof object === "object" && ! object ?. id ) {
22
+ if ( typeof object === "object" && object ?. key ) {
23
+ tmp [ prop ] = object . key ;
24
+ } else if ( typeof object === "object" && ! object ?. key ) {
25
25
const list = [ ] ;
26
26
27
27
for ( const innerProp in object ) {
28
28
const innerObject = object [ innerProp ] ;
29
29
30
- if ( typeof innerObject === "object" && innerObject ?. id ) {
31
- list . push ( innerObject . id ) ;
30
+ if ( typeof innerObject === "object" && innerObject ?. key ) {
31
+ list . push ( innerObject . key ) ;
32
32
}
33
33
}
34
34
You can’t perform that action at this time.
0 commit comments