Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Finding Variable References in Code Snippet

0
0
Hi,

I have small snippets of javascript code that contain 1-10 references to variables that belong to a 6000+ survey. The vast majority of these items do not have values, and even of the ones that do only a small minority (usually no more than 10) are actually referenced in each snippet of code.

Instantiating all 6000+ variables is proving to be too slow and costly to do for each snippet.

Is there a way to pull out all the variable references/names in a snippet of code before it is actually executed? That way, I could see which ones were actually required and pre-load their values ahead of the code to be run.

Otherwise, I fear I'll have to do some sort of string/regex search, which I would like to avoid.

Viewing all articles
Browse latest Browse all 2297