Variable TreesConst

Trees: {
    helper: {
        fromArray: (<T>(array, comparator) => undefined | Tree<T>);
        getAncestorsTrail: (<T>(node, comparator) => T[]);
        push: (<T>(tree, at, children, comparator) => void);
        truncate: (<T>(tree, from, comparator) => undefined | Tree<T>);
    };
} = ...

Type declaration

  • helper: {
        fromArray: (<T>(array, comparator) => undefined | Tree<T>);
        getAncestorsTrail: (<T>(node, comparator) => T[]);
        push: (<T>(tree, at, children, comparator) => void);
        truncate: (<T>(tree, from, comparator) => undefined | Tree<T>);
    }

    Tree helper methods.

    • fromArray: (<T>(array, comparator) => undefined | Tree<T>)

      Creates a tree structure from the given array.

      Param: array

      The array to create the tree from.

      Param: comparator

      The tree nodes comparator.

      Returns

      the result tree.

        • <T>(array, comparator): undefined | Tree<T>
        • Creates a tree structure from the given array.

          Type Parameters

          • T extends {
                parent?: T;
            }

          Parameters

          • array: T[]

            The array to create the tree from.

          • comparator: TreeComparator<T>

            The tree nodes comparator.

          Returns undefined | Tree<T>

          the result tree.

    • getAncestorsTrail: (<T>(node, comparator) => T[])

      Gets an array containing all the ancestors of the given node in an ascending order.

      Param: node

      The node from which to extract the ancestor trail.

      Param: comparator

      The tree nodes comparator.

      Returns

      an array containing all the ancestors of the given node in an ascending order.

        • <T>(node, comparator): T[]
        • Gets an array containing all the ancestors of the given node in an ascending order.

          Type Parameters

          • T extends {
                parent?: T;
            }

          Parameters

          • node: T

            The node from which to extract the ancestor trail.

          • comparator: TreeComparator<T>

            The tree nodes comparator.

          Returns T[]

          an array containing all the ancestors of the given node in an ascending order.

    • push: (<T>(tree, at, children, comparator) => void)

      Adds a new elements into the tree at the given node.

      Param: tree

      The tree to add the new element into.

      Param: at

      The node in the tree where to add the new element.

      Param: children

      The element to add.

      Param: comparator

      The tree node comparator.

        • <T>(tree, at, children, comparator): void
        • Adds a new elements into the tree at the given node.

          Type Parameters

          • T

          Parameters

          • tree: Tree<T>

            The tree to add the new element into.

          • at: Tree<T>

            The node in the tree where to add the new element.

          • children: Tree<T>[]

            The element to add.

          • comparator: TreeComparator<T>

            The tree node comparator.

          Returns void

    • truncate: (<T>(tree, from, comparator) => undefined | Tree<T>)

      Truncates the given tree from the given node.

      Param: tree

      The tree to truncate.

      Param: from

      The node to truncate the tree from.

      Param: comparator

      The tree nodes comparator.

      Returns

      the truncated tree.

        • <T>(tree, from, comparator): undefined | Tree<T>
        • Truncates the given tree from the given node.

          Type Parameters

          • T

          Parameters

          • tree: Tree<T>

            The tree to truncate.

          • from: T

            The node to truncate the tree from.

          • comparator: TreeComparator<T>

            The tree nodes comparator.

          Returns undefined | Tree<T>

          the truncated tree.

Generated using TypeDoc