code: private static boolean isDeclaration(Node n) {
      switch (n.getParent().getToken()) {
        case LET:
        case CONST:
        case VAR:
        case CATCH:
          return true;
        case FUNCTION:
          return n == n.getParent().getFirstChild();
  
        case PARAM_LIST:
          return n.getGrandparent().isFunction();
  
        default:
          return false;
      }
    }
docs: Determines if the given name is a declaration, which can be a declaration
  of a variable, function, or argument.