function nearestBody(){var ancestors=context.getAncestors();var ancestor=ancestors.pop(),generation=1;while(ancestor&&["Program","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"].indexOf(ancestor.type)<0){generation+=1;ancestor=ancestors.pop();}return{// Type of containing ancestor
type:ancestor.type,// Separation between ancestor and node
distance:generation};}
Find the nearest Program or Function ancestor node.
@returns {Object} Ancestor's type and distance from node.