ixfx
    Preparing search index...

    Functions

    add

    Adds a child node to parent. If child already has a parent, it is removed from that parent.

    addValue

    Adds a new child node based on a value

    asDynamicTraversable

    Projects node as a dynamic traversable. Dynamic in the sense that it creates the traversable project for nodes on demand. A consequence is that node identities are not stable.

    breadthFirst

    Breadth-first iteration of the children of node

    children

    Iterate over direct children of root, yielding TreeNode instances. Use childrenValues to iterate over child values

    childrenLength
    childrenValues

    Iterate over the value of direct children of root. Use children if you want to iterate over TreeNode instances instead.

    compare

    Compares two nodes.

    computeMaxDepth

    Computes the maximum depth of the tree. That is, how many steps down from node it can go. If a tree is: root -> childA -> subChildB

    createNode

    Creates a TreeNode instance with a given value and parent. Parent node, if specified, has its childrenStore property changed to include new child.

    depthFirst

    Depth-first iteration of the children of node

    findAnyChildByValue

    Using a breadth-first search, return the first child of parent that has value.

    findChildByValue

    Returns the first immediate child of parent that matches value.

    findParentsValue

    Returns the first parent that has a given value.

    followValue
    fromPlainObject
    getRoot

    Traverses up a node to find the root.

    hasAnyChild

    Returns true if prospectiveChild is some child node of parent, anywhere in the tree structure.

    hasAnyParent

    Returns true if prospectiveParent is any ancestor parent of child.

    hasChild

    Returns true if child is an immediate child of parent.

    hasParent

    Returns true if prospectiveParent is the immediate parent of child.

    nodeDepth

    Returns the depth of node. A root node (ie. with no parents) has a depth of 0.

    parents

    Iterate over all parents of child. First result is the immediate parent.

    parentsValues

    Yields the node value of each parent of child. undefined values are not returned.

    queryByValue

    Yield all immediate children of parent that match value.

    queryParentsValue

    Yields all parents of child that have a given value. Use findParentsValue to find the first match only.

    remove

    Removes child from the tree structure it is in. It removes child from its parent. Any sub-children of child still remain connected.

    removeValuelessNodesFromChild

    Starting from a child node, work backwards, removing it and ancestors that have no value

    root

    Creates the root for a tree, with an optional value. Use rootWrapped if you want a more object-oriented mode of access.

    rootWrapped

    Creates a tree, returning it as a WrappedNode for object-oriented access. Use Trees.Mutable.root alternatively.

    setChildren

    Sets the children of parent to a list of children.

    siblings

    Enumeate all siblings of child. This won't include child itself. If child is not part of a tree (ie has no parent) no values are yielded.

    stripParentage

    Converts Trees.TreeNode to Trees.SimplifiedNode, removing the 'parent' fields. This can be useful because if you have the whole tree, the parent field is redundant and because it makes circular references can make dumping to console etc more troublesome.

    throwTreeTest

    Throws an exception if root fails tree validation

    toStringDeep
    treeTest

    Validates the tree from root downwards.

    value
    wrap

    Wraps node n for a more object-oriented means of access. It will wrap child nodes on demand. For this reason, WrappedNode object identity is not stable