title: Count and sort by number of occurrences
body: <p>I have an array like this:</p>
  
  <pre><code>var items = [
    {name: 'popcorn', category: 'snacks'},
    {name: 'nachos', category: 'snacks'},
    ...
    {name: 'coke', category: 'drinks'}
  ];
  </code></pre>
  
  <p>I want to get a list of categories ordered by the number of items on it (most items first):</p>
  
  <pre><code>['snacks', 'drinks']
  </code></pre>
  
  <p>Here is how I did it:</p>
  
  <pre><code>var categories = _.chain(items)
    .countBy(function (i) { return i.category })
    .pairs()
    .sortBy(function (c) { return -c[1] })
    .map(function (c) { return c[0] })
    .value();
  </code></pre>
  
  <p>So the result of <code>countBy</code> is an object, and I have to use <code>pairs</code> to convert it into an array of arrays in order to sort it.</p>
  
  <p>I wonder if there is a more straightforward way to do it? Built-in function?</p>