# list-to-tree2

> Convert list to tree structure

Latest version **1.0.1** (published 2017-08-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install list-to-tree2
pnpm add list-to-tree2
yarn add list-to-tree2
bun add list-to-tree2
```

## 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.0.1 |
| Published | 2017-08-12 |
| First published | 2017-08-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Oleksandr Matviichuk |
| Maintainers | omatviichuk |
| Keywords | tree, list-to-tree |

## Links

- npm: https://www.npmjs.com/package/list-to-tree2
- Repository: https://github.com/sashkomatviychuk/tree.js
- Homepage: https://github.com/sashkomatviychuk/tree.js#readme
- Issues: https://github.com/sashkomatviychuk/tree.js/issues
- npm.io page: https://npm.io/package/list-to-tree2

## Recent versions

- 1.0.1 (latest) — 2017-08-12
- 1.0.0 — 2017-08-12

## README

# tree.js
Build tree from list using id key and parent key. Default id key value is \_id, parent key - \_parent

## Install
Install with npm
```bash
npm install list-to-tree2
```
Install with yarn
```bash
yarn add list-to-tree2
```
## Tests
```bash
npm test
```
## Usage
Also you can open example.js to see usage
```javascript
const listToTree = require('list-to-tree2');
const list = [{
			_id: 1,
			_parent: null,
			prop: 'qwerty',
		}, {
			_id: 2,
			_parent: 1,
			prop: 'asdfg',
		}, {
			_id: 3,
			_parent: null,
			prop: '13sdf',
		}];
    
const tree = listToTree(list);
```
### Parameters
- list - Array of objects with Id key and parentId key. Required
- idKey - Name of id key in list elements. Default - \_id
- parentKey - Name of parentId key. Default  - \_parent

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