lib/rules/no-cond-assign.js
function findConditionalAncestor(node) {
            let currentAncestor = node;

            do {
                if (isConditionalTestExpression(currentAncestor)) {
                    return currentAncestor.parent;
                }
            } while ((currentAncestor = currentAncestor.parent) && !astUtils.isFunction(currentAncestor));

            return null;
        }
function findConditionalAncestor(node) {
            let currentAncestor = node;

            do {
                if (isConditionalTestExpression(currentAncestor)) {
                    return currentAncestor.parent;
                }
            } while ((currentAncestor = currentAncestor.parent) && !astUtils.isFunction(currentAncestor));

            return null;
        }
function findConditionalAncestor ( node ) { let currentAncestor = node ; do { if ( isConditionalTestExpression ( currentAncestor ) ) { return currentAncestor . parent ; } } while ( ( currentAncestor = currentAncestor . parent ) && ! astUtils . isFunction ( currentAncestor ) ) ; return null ; }
Given an AST node, perform a bottom-up search for the first ancestor that represents a conditional statement.
@param {!Object} node The node to use at the start of the search.
@returns {?Object} The closest ancestor node that represents a conditional statement.
Given an AST node perform a bottom - up search for the first ancestor that represents a conditional statement .