UNPKG

es-grid-template

Version:

es-grid-template

10 lines (9 loc) 460 B
import type { AbstractTreeNode } from '../interfaces'; /** * Traverses all nodes and collects them into an array. * The `order` parameter can be used to specify the traversal strategy: * * `pre` - Pre-order traversal (default) * * `post` - Post-order traversal * * `leaf-only` - Ignore internal nodes and collect only leaf nodes */ export default function collectNodes<T extends AbstractTreeNode>(nodes: T[], order?: 'pre' | 'post' | 'leaf-only'): T[];