export function findClosestAncestorNodeByName()

in src/utils/astUtilityFunctions.ts [137:146]


export function findClosestAncestorNodeByName(node: ASTNode, NodeName: string[]): AncestorASTNodeInfo | undefined {
  if (isPropertyNode(node) && NodeName.includes(node.keyNode.value)) {
    return { node, nodeName: node.keyNode.value }
  }
  if (!node.parent) {
    return undefined
  }

  return findClosestAncestorNodeByName(node.parent, NodeName)
}