title: filter javascript object
body: <p>I have a javascript object, that could be something like this</p>
  
  <pre><code>{
      "users": [{
          "id": "52",
          "name": "User name one",
          "profile": "student",
          "statusId": 1
      },...
  </code></pre>
  
  <p>I want to modify this object's properties given a set of parameters. Basically I want a new object which properties could match a set of constraints - a filter object - with this form (empty filter):</p>
  
  <pre><code>    var userFilter = {
          id : "",
          name: "",
          profile : "",
          state : ""
      };
  </code></pre>
  
  <p>I've seen the <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter" rel="nofollow">Array.prototype.filter</a>, but can't figure a clean and generic way to use all properties of filter. I've tried this approach with a javascript string that concats all filters and using eval(), but I don't like this approach. Any suggestion ?</p>
  
  <p>Thanks in advance,
  regards</p>