Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function combineRows(ast) {
var thead = util.firstOfType(ast.nodes, 'thead');
if (!thead) return;
var rows = thead.nodes.filter(function(node) {
return node.type === 'tr';
});
if (rows.length === 1) return;
// handle `` (no ``)
if (rows.length === 0) {
var i = 1;
var e = thead.nodes.length - 1;
if (thead.nodes[i].type === 'text') i++;
if (thead.nodes[e].type === 'text') e--;
function tfootNodes(ast) {
var nodes = [];
var tfoot;
for (var i = 0; i < ast.nodes.length; i++) {
var node = ast.nodes[i];
if (node.type === 'tfoot') {
tfoot = node.nodes;
} else {
nodes.push(node);
}
}
if (tfoot) {
var tbody = util.firstOfType(ast.nodes, 'tbody');
if (tbody) {
var len = tfoot.length;
var idx = -1;
while (++idx < len) {
var tok = tfoot[idx];
define(tok, 'parent', tbody);
tbody.nodes.push(tok);
}
}
}
ast.nodes = nodes;
return ast;
}