MCPcopy Index your code
hub / github.com/hizzgdev/jsmind / get_node_after

Method get_node_after

src/jsmind.mind.js:163–183  ·  view source on GitHub ↗

* Get next sibling of a node or node id. * @param {string | Node} node * @returns {Node | null}

(node)

Source from the content-addressed store, hash-verified

161 * @returns {Node | null}
162 */
163 get_node_after(node) {
164 if (!Node.is_node(node)) {
165 var the_node = this.get_node(node);
166 if (!the_node) {
167 logger.error('the node[id=' + node + '] can not be found.');
168 return null;
169 } else {
170 return this.get_node_after(the_node);
171 }
172 }
173 if (node.isroot) {
174 return null;
175 }
176 var idx = node.index;
177 var brothers = node.parent.children;
178 if (brothers.length > idx) {
179 return node.parent.children[idx];
180 } else {
181 return null;
182 }
183 }
184 /**
185 * Move a node to new parent/position.
186 * @param {Node} node

Callers 4

jsmind.jsFile · 0.80
find_node_afterMethod · 0.80

Calls 2

get_nodeMethod · 0.95
is_nodeMethod · 0.45

Tested by

no test coverage detected