Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
rk4718
wacc_26_web_client
Commits
9ab5ddde
Commit
9ab5ddde
authored
Mar 13, 2020
by
Matej Genci
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
createGraphNode accepts whole node
parent
f6fdd33e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
src/Comm.js
src/Comm.js
+7
-3
No files found.
src/Comm.js
View file @
9ab5ddde
...
...
@@ -16,17 +16,21 @@ const testGraphData = [{
export
function
astMetaToGraphData
(
astMeta
)
{
let
firstNode
=
astMeta
.
nodes
[
"
0
"
];
let
graphData
=
createGraphNode
(
firstNode
.
name
,
firstNode
.
value
,
firstNode
.
children
,
astMeta
);
let
graphData
=
createGraphNode
(
firstNode
,
astMeta
);
return
graphData
}
function
createGraphNode
(
name
,
value
,
childrenIDs
,
astMeta
){
function
createGraphNode
(
node
,
astMeta
){
let
name
=
node
.
name
;
let
value
=
node
.
value
;
let
childrenIDs
=
node
.
children
;
let
children
=
[];
if
(
typeof
childrenIDs
!==
"
undefined
"
)
{
for
(
let
i
=
0
;
i
<
childrenIDs
.
length
;
i
++
)
{
let
childID
=
childrenIDs
[
i
];
let
child
=
astMeta
.
nodes
[
childID
];
children
.
push
(
createGraphNode
(
child
.
name
,
child
.
value
,
child
.
children
,
astMeta
))
children
.
push
(
createGraphNode
(
child
,
astMeta
))
}
}
// console.log(JSON.stringify(retObj))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment