<div class='type'>Function</div>


<a id='references'></a>


<h2 id="findnearestancestor-key">findNearestAncestor</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun DelegatableNode.findNearestAncestor(key: Any?): TraversableNode?
```


Finds the nearest traversable ancestor with a matching `key`.





<hr class="docs-overload-divider">


<h2 id="findnearestancestor-t">findNearestAncestor</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun <T> T.findNearestAncestor(): T? where T : TraversableNode
```


Finds the nearest ancestor of the same class and key.