`esprima` AST Tree: How to easily detect and add function parens?
<p>TL;DR: i want to do same thing as there <a href="https://github.com/nolanlawson/optimize-js" rel="nofollow">https://github.com/nolanlawson/optimize-js</a> but with <code>esprima</code> when i traverse through AST tree with <code>estraverse</code>.</p>

<p>ESPrima gives same output nodes for following code:</p>

<pre><code>!function (){}()
</code></pre>

<p>and</p>

<pre><code>!(function (){})()
</code></pre>

<p><a href="http://esprima.org/demo/parse.html?code=!function%20()%7B%7D()%0A%0A!(function%20()%7B%7D)()" rel="nofollow">http://esprima.org/demo/parse.html?code=!function%20()%7B%7D()%0A%0A!(function%20()%7B%7D)()</a></p>

<p>For example - i will traverse through AST tree. On Function Expression ExpressionStatement node i want to check - if that node doesn't have parens around function - i want to add it.</p>

<p>So, how i can detect function parens, how i can add them? I look at tokens, but i have no idea how i can associate flat tokens object with object with specified AST node.</p>