Aller au contenu principal

find()

find<T>(node, predicate): Option<T>

Finds the first node matching a predicate (depth-first). Short-circuits on first match.


Type Parameters​

T: T​

The data type


Parameters​

node: Composite<T>​

The root node to search

predicate: (data) => boolean​

Function to test each node


Returns: Option<T>​

Option containing the matching node data


Since​

2.4.0