lib/utils/ast.js
function nearest(predicate, node) {
    while ((node = node.parent)) {
        if (predicate(node)) return node;
    }

    return undefined;
}
function nearest(predicate, node) {
    while ((node = node.parent)) {
        if (predicate(node)) return node;
    }

    return undefined;
}
function nearest ( predicate , node ) { while ( ( node = node . parent ) ) { if ( predicate ( node ) ) return node ; } return undefined ; }
Find the nearest ancestor satisfying `predicate`.
@param   {Function} predicate - predicate to test each ancestor against
@param   {ASTNode} node - child node to begin search at
@returns {ASTNode|undefined} nearest ancestor satisfying `predicate`, if any
Find the nearest ancestor satisfying predicate .