# simplify-tree-nodes

> Replace child nodes' keys with top level parent node's key by given tree

Latest version **0.1.3** (published 2019-05-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install simplify-tree-nodes
pnpm add simplify-tree-nodes
yarn add simplify-tree-nodes
bun add simplify-tree-nodes
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2019-05-10 |
| First published | 2019-05-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 78.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | rehnskiold |

## Links

- npm: https://www.npmjs.com/package/simplify-tree-nodes
- Repository: https://github.com/thunderrun/simplify-tree-nodes
- Homepage: https://github.com/thunderrun/simplify-tree-nodes#readme
- Issues: https://github.com/thunderrun/simplify-tree-nodes/issues
- npm.io page: https://npm.io/package/simplify-tree-nodes

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [tree-model](https://npm.io/package/tree-model.md) ^1.0.7
- [array-includes-all](https://npm.io/package/array-includes-all.md) ^2.0.0

## Recent versions

- 0.1.3 (latest) — 2019-05-10
- 0.1.2 — 2019-05-09
- 0.1.1 — 2019-05-09

## README

# simplify-tree-nodes

Replace child nodes' keys with top level parent node's key by given tree.

## Example

```js
import simplifyTreeNodes from 'simplify-tree-nodes'

const treeData = [
  {
    key: "0-0",
    children: [
      {
        key: "0-0-0"
      },
      {
        key: "0-0-1"
      }
    ]
  },
  {
    key: "0-1",
    children: [
      {
        key: "0-1-0"
      },
      {
        key: "0-1-1"
      },
      {
        key: "0-1-2",
        children: [
          {
            key: "0-1-2-0"
          },
          {
            key: "0-1-2-1"
          }
        ]
      }
    ]
  }
];

const childKeys = ["0-0-0", "0-1-0", "0-1-1", "0-1-2-0", "0-1-2-1"];

const keys = simplifyTreeNodes(childKeys, treeData);

// keys: ['0-0-0', '0-1']
```

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