Constructor
new NodeWrapper(node, parentopt)
Create a new NodeWrapper
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
node |
object | ||
parent |
NodeWrapper |
<optional> |
Members
children :Array.<NodeWrapper>
Type:
- Array.<NodeWrapper>
node :object
Type:
- object
parent :NodeWrapper
Type:
Methods
(static) create(node, parentopt) → {NodeWrapper}
Create a new NodeWrapper or return the argument if it's already a NodeWrapper
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
node |
object | NodeWrapper | ||
parent |
NodeWrapper |
<optional> |
Returns:
- Type
- NodeWrapper
(static) isNodeWrapper(node) → {NodeWrapper}
Return true if the provided argument is a NodeWrapper
Parameters:
Name | Type | Description |
---|---|---|
node |
any |
Returns:
- Type
- NodeWrapper
reduce(fn, acc) → {object}
Recursivley reduce the node and it's children
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | |
acc |
any |
Returns:
- Type
- object
toJSON() → {object}
Return the JSON representation
Returns:
- Type
- object