tscheck.js
function getEnclosingScope(node) {
    while  (node.type !== 'FunctionDeclaration' && 
            node.type !== 'FunctionExpression' && 
            node.type !== 'CatchClause' &&
            node.type !== 'Program') {
        node = node.$parent;
    }
    return node;
}
function getEnclosingScope(node) {
    while  (node.type !== 'FunctionDeclaration' && 
            node.type !== 'FunctionExpression' && 
            node.type !== 'CatchClause' &&
            node.type !== 'Program') {
        node = node.$parent;
    }
    return node;
}
function getEnclosingScope ( node ) { while ( node . type !== 'FunctionDeclaration' && node . type !== 'FunctionExpression' && node . type !== 'CatchClause' && node . type !== 'Program' ) { node = node . $parent ; } return node ; }
Returns the function, program or catch clause immediately enclosing the given node, possibly the node itself.
Returns the function program or catch clause immediately enclosing the given node possibly the node itself .