lib/rules/no-loop-func.js
function getTopLoopNode(node, excludedNode) {
    const border = excludedNode ? excludedNode.range[1] : 0;
    let retv = node;
    let containingLoopNode = node;

    while (containingLoopNode && containingLoopNode.range[0] >= border) {
        retv = containingLoopNode;
        containingLoopNode = getContainingLoopNode(containingLoopNode);
    }

    return retv;
}
function getTopLoopNode(node, excludedNode) {
    const border = excludedNode ? excludedNode.range[1] : 0;
    let retv = node;
    let containingLoopNode = node;

    while (containingLoopNode && containingLoopNode.range[0] >= border) {
        retv = containingLoopNode;
        containingLoopNode = getContainingLoopNode(containingLoopNode);
    }

    return retv;
}
function getTopLoopNode ( node , excludedNode ) { const border = excludedNode ? excludedNode . range [ 1 ] : 0 ; let retv = node ; let containingLoopNode = node ; while ( containingLoopNode && containingLoopNode . range [ 0 ] >= border ) { retv = containingLoopNode ; containingLoopNode = getContainingLoopNode ( containingLoopNode ) ; } return retv ; }
Gets the containing loop node of a given node.
If the loop was nested, this returns the most outer loop.

@param {ASTNode} node - A node to get. This is a loop node.
@param {ASTNode|null} excludedNode - A node that the result node should not
include.
@returns {ASTNode} The most outer loop node.
Gets the containing loop node of a given node . If the loop was nested this returns the most outer loop .