code: function endNode() {
              if (parent.children) {
                  mergeChildren(parent.children);
                  sortChildren(parent.children);
              }
              parent = parentsStack.pop();
          }
docs: Call after calling `startNode` and adding children to it.