# multiple-tree

> Nodejs Multiple tree lib

Latest version **1.0.1** (published 2021-02-22) · GPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install multiple-tree
pnpm add multiple-tree
yarn add multiple-tree
bun add multiple-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.0.1 |
| Published | 2021-02-22 |
| First published | 2021-02-22 |
| Weekly downloads | 0 |
| License | GPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 25 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 吉法师 |
| Maintainers | jifashi |
| Keywords | tree, Multiple |

## Links

- npm: https://www.npmjs.com/package/multiple-tree
- Repository: https://gitee.com/onlyyyy_admin/multiple-tree
- npm.io page: https://npm.io/package/multiple-tree

## Recent versions

- 1.0.1 (latest) — 2021-02-22
- 1.0.0 — 2021-02-22

## README

# MultipleTree

## 介绍
Nodejs实现的多叉树库

## APIS

1. select(object)

传入一个对象 判断在多叉树中是否存储了这个对象
return : true/false

2. insert(object)

插入这个对象，true为成功，false则说明已经存在

3. grow(object)

不存在则插入 返回true，存在返回false

4. delete(object)

删除对象

5. clear()

清空字典树

6. walk()

返回整个字典树对象

## 例子

```js
const Tree = require('multiple-tree');

let tree = new Tree();

let a = {
    a:1,
    b:2,
    c:3
}

tree.insert(a);
console.log("tree select ",tree.select(a));

console.log(tree.insert({
    a:1,b:2,c:3,d:4
}));

tree.insert({
    a:1,b:2,c:3,d:5
});
tree.insert({
    a:1,b:2,c:3,d:7
});
tree.grow({
    a:1,b:2,c:3,d:6
});
tree.grow({
    a:1,b:2,c:3,d:8
});
tree.grow({
    a:1,b:2,c:3,d:9
});
tree.grow({
    a:1,b:2,c:3,d:9,e:10
});
console.log(tree.grow({
    a:1,b:2,c:3,d:9,e:10
}));
console.log("tree walk ",JSON.stringify(tree.walk()));
tree.delete({
    a:1,b:2,c:3,d:9,e:10
})
console.log("tree walk ",JSON.stringify(tree.walk()));

```

输出:

``` js
tree select  true
true
false
tree walk  {"1":{"2":{"3":{"4":{},"5":{},"6":{},"7":{},"8":{},"9":{"10":{}}}}}}
tree walk  {"1":{"2":{"3":{"4":{},"5":{},"6":{},"7":{},"8":{},"9":{}}}}}
```

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