# graft-tree

> Tree Data Structure with Multiple Branch Flavors

Latest version **1.3.0** (published 2021-11-03) · ISC license · 0 weekly downloads

## Install

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

## 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.3.0 |
| Published | 2021-11-03 |
| First published | 2018-07-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 35.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | fantasyui.com |
| Maintainers | fantasyui.com |

## Links

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

## Recent versions

- 1.3.0 (latest) — 2021-11-03
- 1.2.0 — 2019-04-12
- 1.1.0 — 2018-07-11

## README

# graft-tree
Tree Data Structure with Multiple Branch Flavors

```JavaScript

const Node = require('graft-tree');

const dungeon = new Node('Dungeon');

const lobby = dungeon.add('Lobby');

let roomNumber = 0;

let roomMaker = function(parent){
  roomNumber = roomNumber +1;
  const room = parent.add('Room #'+roomNumber);
  room.on('object', (thing)=>{
    if(thing == 'Bob'){
      if(Math.random() > .5){
      const newRoom = roomMaker(room);
      console.log(room.location().join('/'), 'Bob made a new room ('+room.name +'->'+newRoom.name+')');
      }else{
        console.log(room.location().join('/'), 'Bob finished building');
      }
    }
  });
  return room;
}

roomMaker(lobby.add('Room #'+roomNumber)); // Create the first room
dungeon.pipe('Bob');
dungeon.pipe('Bob');
dungeon.pipe('Bob');
dungeon.pipe('Bob');


```

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