Q.Tree Class
Creates a Q.Tree object
Constructor
Q.Tree
-
[linked={}]
Parameters:
-
[linked={}]
Object optionalIf supplied, then this object is used as the internal tree that Tree operates on.
Item Index
Methods
Methods
breadthFirst
-
callback
-
[context=null]
Traverse the tree breadth-first and call the callback
Parameters:
-
callback
FunctionWill receive (path, value, tree, context)
-
[context=null]
Mixed optionalTo propagate some context to the callback
clear
-
[keys=null]
Clears the value of a field, removing that key from the tree
Parameters:
Returns:
Returns whether the field to be cleared was found
depthFirst
-
callback
-
[context=null]
Traverse the tree depth-first and call the callback
Parameters:
-
callback
FunctionWill receive (path, value, tree, context)
-
[context=null]
Mixed optionalTo propagate some context to the callback
diff
-
tree
Calculates a diff between this tree and another tree
Parameters:
-
tree
Q.Tree
Returns:
This tree holds the results of the diff
get
-
[keys=[]
-
[def=undefined]
Gets the value of a field in the tree
Parameters:
Returns:
The field if it is found, otherwise def or undefined.
load
-
filename
-
[callback=null]
Loads data into a tree from a file.
merge
-
second
-
[under=false]
Merges a tree over the top of an existing tree
Parameters:
Returns:
Returns the resulting tree, modified by the merge.
save
-
filename
-
[arrayPath=[]
-
[prefixPath=[]
-
[callback=null]
Saves a (sub)tree of parameters to a file
Parameters:
-
filename
StringThe filename to save into. If tree was loaded from a single file, you can leave this blank to update that file.
-
[arrayPath=[]
Array optionalArray of keys identifying the path of the subtree to save
-
[prefixPath=[]
Array optionalArray of keys identifying the prefix path of the subtree to save
-
[callback=null]
Function optionalFunction to call back, with params (err)