commit.js 396 Bytes
Newer Older
1
export function normalizeData(data, path, extra = () => {}) {
Phil Hughes's avatar
Phil Hughes committed
2 3 4
  return data.map(d => ({
    sha: d.commit.id,
    message: d.commit.message,
5
    titleHtml: d.commit_title_html,
Phil Hughes's avatar
Phil Hughes committed
6 7 8
    committedDate: d.commit.committed_date,
    commitPath: d.commit_path,
    fileName: d.file_name,
9
    filePath: `${path}/${d.file_name}`,
Phil Hughes's avatar
Phil Hughes committed
10 11 12 13 14
    type: d.type,
    __typename: 'LogTreeCommit',
    ...extra(d),
  }));
}