title: What is a good way of achieving this filtering?
body: <p>I have data like the following:</p>
  
  <pre><code>var data = [{
     id: 1,
     date: new Date("2010-01-01"),
     value: 10
  }, {
     id: 2,
     date: new Date("2010-01-01"),
     value: 11
  }, {
     id: 3,
     date: new Date("2010-01-01"),
     value: 12
  }, {
     id: 4,
     date: new Date("2010-01-02"),
     value: 10
  }, {
     id: 5,
     date: new Date("2010-01-03"),
     value: 10
  }, {
     id: 6,
     date: new Date("2010-01-03"),
     value: 21
  }, {
     id: 7,
     date: new Date("2010-01-03"),
     value: 22
  }, {
     id: 8,
     date: new Date("2010-01-03"),
     value: 23
  }];
  </code></pre>
  
  <p>I am trying to apply two kinds of filters: </p>
  
  <ul>
  <li><code>Filter1</code> should give me only those points that differ by 1 in their <code>value</code> field but having the same <code>date</code> field. Therefore, this should return a new dataset containing data records with ids 1,2,3, 6,7,8 (the first three because values are 10,11,12 and last three because values are 21,22,23)</li>
  <li><code>Filter2</code> should give me only those points that differ by 1 day in their <code>date</code> field but having the same <code>value</code> field. Therefore, this should return a new dataset containing data records with ids 1,4,5</li>
  </ul>
  
  <p>I am currently doing this in C# on the server-side but am looking to see if there is an efficient way to do this in Javascript. Any suggestions?</p>