INNER CODE UNIT · JavaScript
pruneToWritten
tradingview/lightweight-charts · website/plugins/docs-markdown/index.js:267
function pruneToWritten(nodes, written) {
/** @type {DocsNode[]} */
const result = [];
for (const node of nodes) {
if (node.kind === 'category') {
const children = pruneToWritten(node.children, written);
if (children.length > 0) {
result.push({ kind: 'category', label: node.label, children });
}
} else if (written.has(node.permalink)) {
result.push(node);
}
}
return result;
}
// ---------------------------------------------------------------------------
// Markdown / MDX cleaning