lib/pullRequests.js
function extractDiffData(diff) {
  print(['Extract diff for ', clc.yellow.bold(`${diff.user}/${diff.repo}#${diff.number}`), clc.white.italic(` (${diff.title})`)], debug);
  return {
    user: diff.user,
    repo: diff.repo,
    title: diff.title,
    number: diff.number,
    link: diff.link,
    createdAt: diff.createdAt,
    updatedAt: diff.updatedAt,
    labels: diff.labels,
    aheadBy: diff.ahead_by,
    behindBy: diff.behind_by,
    status: diff.status,
    totalCommits: diff.total_commits,
    author: {
      login: diff.merge_base_commit.author ? diff.merge_base_commit.author.login : 'Unknown',
      avatarUrl: diff.merge_base_commit.author ? diff.merge_base_commit.author.avatar_url : '',
    },
    files: diff.files.map((file) => {
      return {
        filename: file.filename,
        status: file.status,
        additions: file.additions,
        deletions: file.deletions,
        changes: file.changes,
        patch: analyzePatch(file.patch || '')
      };
    })
  };
}
function extractDiffData(diff) {
  print(['Extract diff for ', clc.yellow.bold(`${diff.user}/${diff.repo}#${diff.number}`), clc.white.italic(` (${diff.title})`)], debug);
  return {
    user: diff.user,
    repo: diff.repo,
    title: diff.title,
    number: diff.number,
    link: diff.link,
    createdAt: diff.createdAt,
    updatedAt: diff.updatedAt,
    labels: diff.labels,
    aheadBy: diff.ahead_by,
    behindBy: diff.behind_by,
    status: diff.status,
    totalCommits: diff.total_commits,
    author: {
      login: diff.merge_base_commit.author ? diff.merge_base_commit.author.login : 'Unknown',
      avatarUrl: diff.merge_base_commit.author ? diff.merge_base_commit.author.avatar_url : '',
    },
    files: diff.files.map((file) => {
      return {
        filename: file.filename,
        status: file.status,
        additions: file.additions,
        deletions: file.deletions,
        changes: file.changes,
        patch: analyzePatch(file.patch || '')
      };
    })
  };
}
function extractDiffData ( diff ) { print ( [ 'Extract diff for ' , clc . yellow . bold ( ` ${ diff . user } ${ diff . repo } ${ diff . number } ` ) , clc . white . italic ( ` ${ diff . title } ` ) ] , debug ) ; return { user : diff . user , repo : diff . repo , title : diff . title , number : diff . number , link : diff . link , createdAt : diff . createdAt , updatedAt : diff . updatedAt , labels : diff . labels , aheadBy : diff . ahead_by , behindBy : diff . behind_by , status : diff . status , totalCommits : diff . total_commits , author : { login : diff . merge_base_commit . author ? diff . merge_base_commit . author . login : 'Unknown' , avatarUrl : diff . merge_base_commit . author ? diff . merge_base_commit . author . avatar_url : '' , } , files : diff . files . map ( ( file ) => { return { filename : file . filename , status : file . status , additions : file . additions , deletions : file . deletions , changes : file . changes , patch : analyzePatch ( file . patch || '' ) } ; } ) } ; }
Refine a complete diff down to its useful information
@param  {Object} diff Too much information about a diff
@return {Object}      Just enough information about a diff
Refine a complete diff down to its useful information