lib/pullRequests.js
function analyzePatch(patch) {
  const patchLines = patch.split('\n').reduce((reducedPatch, currentLine) => {
    if (currentLine.match(/^[-+]/)) {
      return reducedPatch.concat(currentLine.replace(/^[-+]+\s*/, ''));
    }
    return reducedPatch;
  }, []);
  return {
    lines: patchLines.length,
    chars: patchLines.join('').length
  };
}
function analyzePatch(patch) {
  const patchLines = patch.split('\n').reduce((reducedPatch, currentLine) => {
    if (currentLine.match(/^[-+]/)) {
      return reducedPatch.concat(currentLine.replace(/^[-+]+\s*/, ''));
    }
    return reducedPatch;
  }, []);
  return {
    lines: patchLines.length,
    chars: patchLines.join('').length
  };
}
function analyzePatch ( patch ) { const patchLines = patch . split ( '\n' ) . reduce ( ( reducedPatch , currentLine ) => { if ( currentLine . match ( / ^[-+] / ) ) { return reducedPatch . concat ( currentLine . replace ( / ^[-+]+\s* / , '' ) ) ; } return reducedPatch ; } , [ ] ) ; return { lines : patchLines . length , chars : patchLines . join ( '' ) . length } ; }
Reduce a patch down to just changed lines
@param  {String} patch The complete patch with surrounding context
@return {Object}       Stats about the changed lines
Reduce a patch down to just changed lines