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