Find Unassigned Variable Names in JavaScript

28 views
Skip to first unread message

Alan Wells

unread,
Jan 12, 2020, 4:00:29 PM1/12/20
to Google Apps Script Community
Just for fun, I created a function that parses another function to get the variable names.  Then I decided that I'd try to write some code that would look for variable names that have no value assigned to them.  I've posted the code to GitHub.  In it's current state, it will only process one function at a time, and it doesn't have a way to get all the function names in your project.  The Apps Script API would need to be used to get all the function names in the project.

cbmserv...@gmail.com

unread,
Jan 20, 2020, 4:31:43 PM1/20/20
to google-apps-sc...@googlegroups.com

Thanks for publishing this. It works well but does not seem to like a particular syntax I had in one of the functions I had:

 

  var name = propertyName + Utilities.formatDate(lastMonth,"PST", "MMM");

It seems to get hung up on the fact there is a closing parenthesis.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/e26a5043-0d4c-4121-a463-a9a0eb8e44be%40googlegroups.com.

Alan Wells

unread,
Jan 22, 2020, 8:12:35 PM1/22/20
to Google Apps Script Community
Thanks for trying it out, and providing the feedback.  I made some changes to the code, and posted a new version to the GitHub repo just now.  It's not giving an error on that line anymore, but I'm not sure how you were using "propertyName"


On Monday, January 20, 2020 George wrote:

Thanks for publishing this. It works well but does not seem to like a particular syntax I had in one of the functions I had:

 

  var name = propertyName + Utilities.formatDate(lastMonth,"PST", "MMM");

It seems to get hung up on the fact there is a closing parenthesis.

 

 

From: google-apps-script-community@googlegroups.com <google-apps-script-community@googlegroups.com> On Behalf Of Alan Wells
Sent: January 12, 2020 1:00 PM
To: Google Apps Script Community <google-apps-script-community@googlegroups.com>
Subject: [Apps-Script] Find Unassigned Variable Names in JavaScript

 

Just for fun, I created a function that parses another function to get the variable names.  Then I decided that I'd try to write some code that would look for variable names that have no value assigned to them.  I've posted the code to GitHub.  In it's current state, it will only process one function at a time, and it doesn't have a way to get all the function names in your project.  The Apps Script API would need to be used to get all the function names in the project.

 

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.

cbmserv...@gmail.com

unread,
Jan 22, 2020, 9:15:36 PM1/22/20
to google-apps-sc...@googlegroups.com

Propertyname is just another variable. The tool did not complain about that. It complained about the  “)” for some reason.

 

Thanks for updating, will check it out.

 

George

 

From: google-apps-sc...@googlegroups.com <google-apps-sc...@googlegroups.com> On Behalf Of Alan Wells
Sent: January 22, 2020 5:13 PM
To: Google Apps Script Community <google-apps-sc...@googlegroups.com>
Subject: Re: [Apps-Script] Find Unassigned Variable Names in JavaScript

 

Thanks for trying it out, and providing the feedback.  I made some changes to the code, and posted a new version to the GitHub repo just now.  It's not giving an error on that line anymore, but I'm not sure how you were using "propertyName"

On Monday, January 20, 2020 George wrote:

Thanks for publishing this. It works well but does not seem to like a particular syntax I had in one of the functions I had:

 

  var name = propertyName + Utilities.formatDate(lastMonth,"PST", "MMM");

It seems to get hung up on the fact there is a closing parenthesis.

 

 

From: google-apps-sc...@googlegroups.com <google-apps-sc...@googlegroups.com> On Behalf Of Alan Wells
Sent: January 12, 2020 1:00 PM
To: Google Apps Script Community <google-apps-sc...@googlegroups.com>
Subject: [Apps-Script] Find Unassigned Variable Names in JavaScript

 

Just for fun, I created a function that parses another function to get the variable names.  Then I decided that I'd try to write some code that would look for variable names that have no value assigned to them.  I've posted the code to GitHub.  In it's current state, it will only process one function at a time, and it doesn't have a way to get all the function names in your project.  The Apps Script API would need to be used to get all the function names in the project.

 

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

--

You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/833a4d6c-3a16-4046-9d9e-0d5ac6ec08e7%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages