Constructor
new Tree()
The tree has to start with a single parent, the "root" of the tree.
Methods
add(value, parentValue)
Add a node to the tree and define the parent node
Parameters:
| Name | Type | Description |
|---|---|---|
value |
* | Value of new node |
parentValue |
* | Parent node |
traverse(callback)
Traverse the tree and call a function on each node in the tree.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |