title: evaluate formula in javascript
body: <p>I have a formula and an object containing variables as a key
  My object is as</p>
  
  <pre><code>{
   xyz:{
       v:20
    },
   ab:{
       v:2
    },
   y:{
       v:30
    },
   z:{
       v:40
    },
  
  }
  </code></pre>
  
  <p>Now I have to evaluate the formula</p>
  
  <p>Eg.</p>
  
  <pre><code>xyz+ab*(y+z)
  </code></pre>
  
  <blockquote>
    <p>Result : 20+2*(30+40)</p>
  </blockquote>
  
  <p>Any optimized solution ?</p>
  
  <blockquote>
    <blockquote>
      <p>Please note that keys are in the form of "characters..characters" 
      eg. <code>ABC..XY12</code></p>
      
      <p>Update : Actual object is</p>
    </blockquote>
  </blockquote>
  
  <pre><code>{
   pnl..xyz:{
       v:20
    },
   pxl..ab:{
       v:2
    },
   pnl..y:{
       v:30
    },
   pxl..z:{
       v:40
    },
  
  }
  </code></pre>
  
  <p>and the formula is </p>
  
  <pre><code>pnl..xyz+pxl..ab*(pnl..y+pxl..z)
  </code></pre>