title: Sort array of objects by array of IDs
body: <p>Is it possible, rather easily, to sort an array of objects by an array of IDs? Here's an example:</p>
  
  <pre><code>[{
      id: "A",
      name: "John"
  }, {
      id: "B",
      name: "Bobby"
  }, {
      id: "C",
      name: "Peter"
  }]
  </code></pre>
  
  <p>Now I have an array of objects, each with an unique ID. I then have an array of IDs like so:</p>
  
  <pre><code>var ids = ["C", "A", "B"];
  </code></pre>
  
  <p>Would it be possible to sort the array of objects, so it ends up like this:</p>
  
  <pre><code>[{
      id: "C",
      name: "Peter"
  }, {
      id: "A",
      name: "John"
  }, {
      id: "B",
      name: "Bobby"
  }]
  </code></pre>