title: $.map and $.grep together?
body: <p>I have this simple script:</p>
  
  <pre><code>var stdout = "A test.js\nD README.md\nD CONTRIBUTING.md\nM something.txt";
  
  var out = $.grep( stdout.split("\n"), function (row) {
      return (row.substring(0, 1) == "D");
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/DVL2H/" rel="nofollow">JSFIddle [<strong>x</strong>]</a></p>
  
  <p>It returns an array with only the rows starting with <code>D</code>, this is the result:</p>
  
  <pre><code>D README.md
  D CONTRIBUTING.md
  </code></pre>
  
  <p>I need to get, instead, an array with the rows starting with <code>D</code> but I need to strip the <code>D</code>  from the rows, so I would need this result:</p>
  
  <pre><code>README.md
  CONTRIBUTING.md
  </code></pre>
  
  <p>If I use only <code>$.map</code> I can't find a way to don't return anything in case the condition is not fulfilled...</p>
  
  <pre><code>var out = stdout.split("\n").map(function (row) {
      return (row.substring(0, 1) == "D") ? row.substring(1).trim() : null;
  });
  // returns: [null, 'README.md', 'CONTRIBUTING.md', null]
  // I need: ['README.md', 'CONTRIBUTING.md']
  </code></pre>
  
  <p>I think I should use a mix of <code>$.map</code> and <code>$.grep</code> but looks like too much code for this simple task.<br>
  What is the best way to achieve this?</p>