Skip to main content
cngx-src documentation

filterTree

Functionutils/tree

projects/utils/tree.ts

Description#

Return a new tree containing only nodes whose value matches predicate or have at least one matching descendant. Ancestors of any match are preserved so the path is never broken; branches with zero matches are dropped entirely.

Fresh implementation — not ported from @cngx/data-display/treetable.

Signature#

filterTree(nodes, predicate)

Parameters#

@paramnodes
@parampredicate

Returns#

CngxTreeNode[]