INNER CODE UNIT · JavaScript

hoistRootDocs

tradingview/lightweight-charts · website/plugins/docs-markdown/index.js:238

function hoistRootDocs(nodes) {
	return [
		...nodes.filter((/** @type {DocsNode} */ node) => node.kind === 'doc'),
		...nodes.filter((/** @type {DocsNode} */ node) => node.kind === 'category'),
	];
}

/**
 * @param {DocsNode[]} nodes
 * @param {DocNode[]} accumulator
 */
function collectDocNodes(nodes, accumulator) {
	for (const node of nodes) {
		if (node.kind === 'category') {
			collectDocNodes(node.children, accumulator);
		} else {
			accumulator.push(node);
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…