title: How can I use lodash/underscore to sort by multiple nested fields?
body: <p>I want to do something like this:</p>
  
  <pre><code>var data = [
      {
          sortData: {a: 'a', b: 2}
      },
      {
          sortData: {a: 'a', b: 1}
      },
      {
          sortData: {a: 'b', b: 5}
      },
      {
          sortData: {a: 'a', b: 3}
      }
  ];
  
  data = _.sortBy(data, ["sortData.a", "sortData.b"]);
  
  _.map(data, function(element) {console.log(element.sortData.a + " " + element.sortData.b);});
  </code></pre>
  
  <p>And have it output this:</p>
  
  <pre><code>"a 1"
  "a 2"
  "a 3"
  "b 5"
  </code></pre>
  
  <p>Unfortunately, this doesn't work and the array remains sorted in its original form.  <a href="https://stackoverflow.com/a/24111473/61624">This would work if the fields weren't nested inside the <code>sortData</code>.</a>  How can I use lodash/underscore to sort an array of objects by more than one nested field?</p>
  
  <p>I've turned this into a lodash feature request: <a href="https://github.com/lodash/lodash/issues/581" rel="noreferrer">https://github.com/lodash/lodash/issues/581</a></p>