summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/utils/commit.js
blob: 90ac01c58743668a4f2dce6a96d8d27bdc3bbaa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// eslint-disable-next-line import/prefer-default-export
export function normalizeData(data, path, extra = () => {}) {
  return data.map(d => ({
    sha: d.commit.id,
    message: d.commit.message,
    titleHtml: d.commit_title_html,
    committedDate: d.commit.committed_date,
    commitPath: d.commit_path,
    fileName: d.file_name,
    filePath: `${path}/${d.file_name}`,
    type: d.type,
    __typename: 'LogTreeCommit',
    ...extra(d),
  }));
}