# reverse-tree

> Convert string represented tree back into the structured JSON

Latest version **1.0.1** (published 2020-10-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install reverse-tree
pnpm add reverse-tree
yarn add reverse-tree
bun add reverse-tree
```

Provides the command `reverse-tree`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-10-03 |
| First published | 2020-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ryohey |
| Maintainers | ryohey |

## Links

- npm: https://www.npmjs.com/package/reverse-tree
- Repository: https://github.com/ryohey/reverse-tree
- Issues: https://github.com/ryohey/reverse-tree/issues
- npm.io page: https://npm.io/package/reverse-tree

## Recent versions

- 1.0.1 (latest) — 2020-10-03
- 1.0.0 — 2020-10-03

## README

# reverse-tree

Convert string represented tree back into the structured JSON

## Installation

```bash
npm install -g reverse-tree
```

## Usage

### Command

`reverse-tree <preset>`

reverse-tree reads stdin.

### Preset

- `tree` (default)
- `clang`

### Example

```bash
tree | reverse-tree | jq
```

```bash
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

```json
{
  "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

```js
reverseTree(input, options)
```

### Options

```ts
Options {
  verticalLine: string
  singleJoint: string
  multiJoint: string
}
```

---
_Source: https://npm.io/package/reverse-tree · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
