title: Working with different calculation rules in API
body: <p>Let's say, I have a JS array of object which looks like :</p>
  
  <pre><code>var forceData = 
      [ 
         { 
            "mass":5,
            "acceleration":2,
            "ruleToCalculateForce":"mass * acceleration"
         },
         { 
            "mass":5,
            "acceleration":3,
            "ruleToCalculateForce":"mass * acceleration"
         }
      ]
  </code></pre>
  
  <blockquote>
    <p>ruleToCalculateForce contains how to calculate <strong>force</strong> using mass
    and acceleration using Newton's Law which is <strong>Force = mass * acceleration</strong>. The value of this key has same names of the keys associated with it <strong>(mass &amp; acceleration)</strong>.</p>
  </blockquote>
  
  <p>Now what I want is to calculate the result which multiplies the mass &amp; acceleration based on the rule defined in ruleToCalculateForce. </p>
  
  <p>So, what I am trying to say is that, Is it possible to convert <strong>forceData</strong> array of object to something like this where result (a new key) <strong>can be calculated based on the rule defined in ruleToCalculateForce</strong>: </p>
  
  <pre><code>var forceData = 
      [ 
         { 
            "mass":5,
            "acceleration":2,
            "result" : 10,
            "ruleToCalculateForce":"mass * acceleration"
         },
         { 
            "mass":5,
            "acceleration":3,
            "result" : 15,
            "ruleToCalculateForce":"mass * acceleration"
         }
      ]
  </code></pre>
  
  <p><strong>The forceData rule can be dynamic. Let's say if the force data is something like :</strong></p>
  
  <pre><code>var forceData = 
          [ 
             { 
                "mass":5,
                "acceleration":2,
                "ruleToCalculateForce":"mass + acceleration"
             },
             { 
                "mass":5,
                "acceleration":3,
                "ruleToCalculateForce":"mass + acceleration"
             }
          ]
  </code></pre>
  
  <p><strong>Then the updated array of object should perform summation instead of multiplication and it should be:</strong></p>
  
  <pre><code>var forceData = 
          [ 
             { 
                "mass":5,
                "acceleration":2,
                "result" : 7,
                "ruleToCalculateForce":"mass + acceleration"
             },
             { 
                "mass":5,
                "acceleration":3,
                "result" : 8,
                "ruleToCalculateForce":"mass + acceleration"
             }
          ]
  </code></pre>