MCPcopy Create free account
hub / github.com/TruthHun/BookStack / appendChild

Function appendChild

static/word2md/mammoth.browser.js:2259–2272  ·  view source on GitHub ↗
(children, child)

Source from the content-addressed store, hash-verified

2257}
2258
2259function appendChild(children, child) {
2260 var lastChild = children[children.length - 1];
2261 if (child.type === "element" && !child.tag.fresh && lastChild && lastChild.type === "element" && child.tag.matchesElement(lastChild.tag)) {
2262 if (child.tag.separator) {
2263 appendChild(lastChild.children, ast.text(child.tag.separator));
2264 }
2265 child.children.forEach(function(grandChild) {
2266 // Mutation is fine since simplifying elements create a copy of the children.
2267 appendChild(lastChild.children, grandChild);
2268 });
2269 } else {
2270 children.push(child);
2271 }
2272}
2273
2274function removeEmpty(nodes) {
2275 return flatMap(nodes, function(node) {

Callers 1

collapseFunction · 0.70

Calls 1

textMethod · 0.80

Tested by

no test coverage detected