KeyDataNode

KeyDataNode

Tree node with key property and data property.

Constructor

new KeyDataNode(key, data)

Create a key-data node with key and given data.

Source:
Parameters:
Name Type Description
key string
data *

Members

children :object

Map of keys to children nodes.

Source:
Type:
  • object

data :*

Data property.

Source:
Type:
  • *

key :string

Node key.

Source:
Type:
  • string

size :number

Number of nodes.

Source:
Type:
  • number

Methods

append(node)

Append the given node to the end of the children list.

Source:
Parameters:
Name Type Description
node KeyDataNode

appendDataByKeyPath(keys, data) → {KeyDataNode}

Append data by path being an array of keys.

Source:
Parameters:
Name Type Description
keys array.<string>
data *
Returns:
Type:
KeyDataNode

The newly created node containing the data.

findByKeyPath(keys)

Fina a node by path being an array of keys.

Source:
Parameters:
Name Type Description
keys array.<string>

getKeyPath() → {array}

Get key path of current node (a key chain from root to itself).

Source:
Returns:
Type:
array

remove(node)

Remove the given node from the branch.

Source:
Parameters:
Name Type Description
node KeyDataNode