MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / _createBranch

Method _createBranch

lib/mapping/tree.js:120–135  ·  view source on GitHub ↗
(node, index, useNewValue, valueHandler)

Source from the content-addressed store, hash-verified

118 }
119
120 _createBranch(node, index, useNewValue, valueHandler) {
121 const newBranch = new Node(node.key.slice(index), node.value, node.edges);
122 node.key = node.key.slice(0, index);
123 node.edges = [ newBranch ];
124 if (useNewValue) {
125 // The previous node value has moved to a leaf
126 // The node containing the new leaf should use the new value
127 node.value = valueHandler();
128 this._onItemAdded();
129 }
130 else {
131 // Clear the value as it was copied in the branch
132 node.value = null;
133 }
134 return newBranch;
135 }
136
137 _onItemAdded() {
138 this.length++;

Callers 1

getOrCreateMethod · 0.95

Calls 2

_onItemAddedMethod · 0.95
sliceMethod · 0.45

Tested by

no test coverage detected