title: Divide JS object list into sub lists of items with common object attribute
body: <p>Given this JS object list:</p>
  
  <pre><code>var items = [
  { 
  'name':'a',
  'id':'ab-1',
  'attr':'value1'
  },
  { 
  'name':'c',
  'id':'ab-2',
  'attr':'value0'
  },
  { 
  'name':'z',
  'id':'ab-1',
  'attr':'value2'
  },
  { 
  'name':'t',
  'id':'ab-2',
  'attr':'value3'
  }    
  ]
  </code></pre>
  
  <p>Is there a nice way to create a list of lists where each list contains objects with common id, like so:</p>
  
  <pre><code> var items = [
   [
      { 
      'name':'a',
      'id':'ab-1',
      'attr':'value1'
      },
      { 
      'name':'z',
      'id':'ab-1',
      'attr':'value2'
      }],
      [
      { 
      'name':'c',
      'id':'ab-2',
      'attr':'value0'
      },        
      { 
      'name':'t',
      'id':'ab-2',
      'attr':'value3'
      }    ]
      ]
  </code></pre>
  
  <p>I can only think of looping through all items first to create a list of unique ids (let's call it id-list) and then looping through all items again this time creating a list for each item in id-list. </p>