Mixin: Node

Node

Mixin type that allows path items (Depot, Dir, and File) to operate like a tree easily.

A node requires that the implementing class provide certain basic properties:

  1. this.children: If the node contains children, this should be defined as an empty array.

  2. this.pathId: This should be an array of path names indicating the absolute location in an easily comparable way.

  3. this.name: The comparable string 'name' of the item

Source:

Methods

(static) getParentName() → {string}

Returns the parent name of this node.

Source:
Returns:
Type
string

(static) insert(child) → {boolean}

Inserts the child into the tree, if it belongs.

Parameters:
Name Type Description
child
Source:
Returns:

Returns true if the child is inserted

Type
boolean

(static) isChildRelation(parent)

Validates that the current node could be a child of the indicated parent.

Parameters:
Name Type Description
parent

The potential parent

Source:

(static) sortChildren()

Source: