write a function that traverses a tree data structure and prints the contents in the specified format (javascript or typescript)
Budget: $10 – $30 USD
write a function that traverses a tree data structure and prints the contents in the specified format (javascript or typescript)
I have this these data
{
"name": "my-project",
"children": [
{
"name": "node_modules",
"children": [
{
"name": "react",
"children": [
{ "name": "docs", "children": [] },
{
"name": "node_modules",
"children": [
{
"name": "webpack",
"children": [
{ "name": "docs", "children": [] },
{ "name": "src", "children": [{ "name": "index.js" }] }
]
}
]
},
{
"name": "src",
"children": [
{ "name": "index.js" },
{ "name": "react", "children": [{ "name": "tree.js" }] }
]
}
]
}
]
},
{ "name": "src", "children": [{ "name": "index.js" }] }
]
}
it needs to be printed on this format
// my-project
// ├── node_modules
// │ └── react
// │ ├── docs
// │ ├── node_modules
// │ │ └── webpack
// │ │ ├── docs
// │ │ └── src
// │ │ └── index.js
// │ └── src
// │ ├── index.js
// │ └── react
// │ └── tree.js
// └── src
// └── index.js
I have this these data
{
"name": "my-project",
"children": [
{
"name": "node_modules",
"children": [
{
"name": "react",
"children": [
{ "name": "docs", "children": [] },
{
"name": "node_modules",
"children": [
{
"name": "webpack",
"children": [
{ "name": "docs", "children": [] },
{ "name": "src", "children": [{ "name": "index.js" }] }
]
}
]
},
{
"name": "src",
"children": [
{ "name": "index.js" },
{ "name": "react", "children": [{ "name": "tree.js" }] }
]
}
]
}
]
},
{ "name": "src", "children": [{ "name": "index.js" }] }
]
}
it needs to be printed on this format
// my-project
// ├── node_modules
// │ └── react
// │ ├── docs
// │ ├── node_modules
// │ │ └── webpack
// │ │ ├── docs
// │ │ └── src
// │ │ └── index.js
// │ └── src
// │ ├── index.js
// │ └── react
// │ └── tree.js
// └── src
// └── index.js
Related categories:
Business, Accounting, Human Resources & Legal
JavaScript
C++ Programming
Node.js
Typescript