F
filterInTree
Finds every node in an object graph a predicate matches, depth-first from the root. Cycle-safe.
function filterInTree<T = any>(root: any, predicate: TreePredicate, options?: TreeSearchOptions): T[]Parameters
| Name | Type | Description |
|---|---|---|
| root | any | The node to start from; it is tested too. |
| predicate | TreePredicate | Tests each non-nullish node. |
| options? | TreeSearchOptions | Which keys to descend into or skip, and how deep. |
Returns
T[]Every match, in visiting order.