title: Passing dynamic key-value pairs to function
body: <p>I am probably overlooking something or just being a noob but, I am having trouble being able to pass key-value pairs to a javascript function.</p>
  
  <p>I am writing a filter module utilizing a Backbone.View and Backbone.Paginator.clientPager collection.  I added a function to the clientPager called whereExpanded() which searches the entire collection without modifying/rendering anything.  </p>
  
  <pre><code>Backbone.Paginator.clientPager.prototype.whereExpanded = function(attrs) {
    return _.filter(this.origModels, function(model) {
      var key;
      for (key in attrs) {
        if (attrs[key] !== model.get(key)) {
          return false;
        }
    });
  };
  </code></pre>
  
  <p>As you can see, it takes the <code>attrs</code> variable and loops over it.  I want to be able to pass in key value pairs to this but, the key and value need to be dynamic.</p>
  
  <pre><code>collection.whereExpanded(filterByField, filterByValue)
  </code></pre>
  
  <p><code>filterByField</code> is the attribute of the Backbone.Model I wish to filter by and <code>filterByValue</code> is the value of the attribute I want to filter.  I have tried utilizing  <code>eval()</code> but I cannot seem to get that to work either.</p>
  
  <p>Any help woudl be greatly appreciated!</p>