Extracting JS variable dependencies from a string
<p>Given a <em>string</em> like the following and a context <code>it</code>:</p>

<pre><code>var myName = it.name;
var lastName = it.name.last;
for(var prop in it.products){ console.log(prop.myVal); }
</code></pre>

<p>I'd like to get all dependencies based on that context when running through a JS interpreter. </p>

<p>So in this case it would return:</p>

<pre><code>name
name.last
products
products[].myVal
</code></pre>

<p>I've built something using RegEx that will grab properties directly off the given context <code>it</code>, but I'm not sure if there's a better way to approach this as this won't handle things like <code>for..in</code> constructs.</p>
