# tree-to-string

> Convert a tree structure into a human friendly string

Latest version **1.1.1** (published 2018-06-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install tree-to-string
pnpm add tree-to-string
yarn add tree-to-string
bun add tree-to-string
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2018-06-21 |
| First published | 2018-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 119 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/tree-to-string
- Repository: https://github.com/mafintosh/tree-to-string
- Issues: https://github.com/mafintosh/tree-to-string/issues
- npm.io page: https://npm.io/package/tree-to-string

## Recent versions

- 1.1.1 (latest) — 2018-06-21
- 1.1.0 — 2018-06-21
- 1.0.0 — 2018-06-20

## README

# tree-to-string


```
npm install tree-to-string
```

## Usage

```js
const treeToString = require('tree-to-string')

const tree = {
  value: [7],
  children: [{
    value: [3, 5],
    children: [{
      value: [2]
    }, {
      value: [4]
    }, {
      value: [6]
    }]
  }, {
    value: [8]
  }]
}

console.log(treeToString(tree))
```

Running the above prints something similar to

```
[ 2 ]─┐
      │
[ 4 ]─┼─[ 3, 5 ]─┐
      │          │
[ 6 ]─┘          ├─[ 7 ]
                 │
           [ 8 ]─┘
```

## API

#### `const str = treeToString(tree, [format])`

Converts a tree to a human friendly string.
The tree should have a layout similar to this

```js
{
  value: someJsObject,
  children: [tree, ...]
}
```

Format defaults to `util.inspect`. Change this to your
own method that pretty prints your object if your prefer.

## License

MIT

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