src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js
function findSurroundASTNode(ast, expn, types) {
        var foundNode = ASTWalker.findNodeAround(ast, expn.start, function (nodeType, node) {
            if (expn.end) {
                return types.includes(nodeType) && node.end >= expn.end;
            } else {
                return types.includes(nodeType);
            }
        });
        return foundNode && _.clone(foundNode.node);
    }
function findSurroundASTNode(ast, expn, types) {
        var foundNode = ASTWalker.findNodeAround(ast, expn.start, function (nodeType, node) {
            if (expn.end) {
                return types.includes(nodeType) && node.end >= expn.end;
            } else {
                return types.includes(nodeType);
            }
        });
        return foundNode && _.clone(foundNode.node);
    }
function findSurroundASTNode ( ast , expn , types ) { var foundNode = ASTWalker . findNodeAround ( ast , expn . start , function ( nodeType , node ) { if ( expn . end ) { return types . includes ( nodeType ) && node . end >= expn . end ; } else { return types . includes ( nodeType ) ; } } ) ; return foundNode && _ . clone ( foundNode . node ) ; }
Finds the surrounding ast node of the given expression of any of the given types
@param {!ASTNode} ast
@param {!{start: number, end: number}} expn - contains start and end offsets of expn
@param {!Array.<string>} types
@return {?ASTNode}
Finds the surrounding ast node of the given expression of any of the given types