Iterates through all the parents (from the nearest until the root)
until one of them matches the given predicate.
If the predicate is matched it will return the found node.
If none is found it will return undefined.
Type Parameters
T extends object
Parent node type.
Parameters
child: object
Target node.
predicate: (parentNode:object)=>boolean
Function that will be run for every parent of the target node, from immediate parent to the root.
Iterates through all the parents (from the nearest until the root) until one of them matches the given predicate. If the predicate is matched it will return the found node. If none is found it will return undefined.