nl_tokens: Find an ancestor of a chunk . Return the distance from the target or - 1 if not found .
pl_tokens: function findAncestorDistance ( src , target , currentDistance ) { if ( target === src ) { return currentDistance ; } const distances = [ ] ; src . getParents ( ) . forEach ( ( srcParentChunkGroup ) => { const distance = findAncestorDistance ( srcParentChunkGroup , <mask> , currentDistance + 1 ) ; if ( distance >= 0 ) { distances . push ( distance ) ; } } ) ; if ( distances . length === 0 ) { return - 1 ; } return Math . min ( ... distances ) ; }