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