reverse-tree
v1.0.1
Published
Convert string represented tree back into the structured JSON
Downloads
1
Readme
reverse-tree
Convert string represented tree back into the structured JSON
Installation
npm install -g reverse-tree
Usage
Command
reverse-tree <preset>
reverse-tree reads stdin.
Preset
tree
(default)clang
Example
tree | reverse-tree | jq
clang -Xclang -ast-dump ViewController.m -fno-color-diagnostics | reverse-tree clang | jq
Output Example
Input
.
├── LICENSE.txt
├── README.md
├── lib
│ ├── mime-type.js
│ ├── parser.js
│ ├── serializer.js
│ └── utils.js
└── package.json
1 directory, 7 files
Output
{
"text": ".",
"children": [
{
"text": "LICENSE.txt",
"children": []
},
{
"text": "README.md",
"children": []
},
{
"text": "lib",
"children": [
{
"text": "mime-type.js",
"children": []
},
{
"text": "parser.js",
"children": []
},
{
"text": "serializer.js",
"children": []
},
{
"text": "utils.js",
"children": []
}
]
},
{
"text": "package.json",
"children": []
}
]
}
JavaScript API
reverseTree(input, options)
Options
Options {
verticalLine: string
singleJoint: string
multiJoint: string
}