lib/rules/no-await-in-loop.js
function isLooped(node, parent) {
    switch (parent.type) {
        case "ForStatement":
            return (
                node === parent.test ||
                node === parent.update ||
                node === parent.body
            );

        case "ForOfStatement":
        case "ForInStatement":
            return node === parent.body;

        case "WhileStatement":
        case "DoWhileStatement":
            return node === parent.test || node === parent.body;

        default:
            return false;
    }
}
function isLooped(node, parent) {
    switch (parent.type) {
        case "ForStatement":
            return (
                node === parent.test ||
                node === parent.update ||
                node === parent.body
            );

        case "ForOfStatement":
        case "ForInStatement":
            return node === parent.body;

        case "WhileStatement":
        case "DoWhileStatement":
            return node === parent.test || node === parent.body;

        default:
            return false;
    }
}
function isLooped ( node , parent ) { switch ( parent . type ) { case "ForStatement" : return ( node === parent . test || node === parent . update || node === parent . body ) ; case "ForOfStatement" : case "ForInStatement" : return node === parent . body ; case "WhileStatement" : case "DoWhileStatement" : return node === parent . test || node === parent . body ; default : return false ; } }
Check whether the given node is in loop.
@param {ASTNode} node A node to check.
@param {ASTNode} parent A parent node to check.
@returns {boolean} `true` if the node is in loop.
Check whether the given node is in loop .