Welcome to mirror list, hosted at ThFree Co, Russian Federation.

utils.js « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ae579fef25f7615dba8e99347f425d25150ed5cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { commitItemIconMap } from './constants';

export const getCommitIconMap = file => {
  if (file.deleted) {
    return commitItemIconMap.deleted;
  } else if (file.tempFile && !file.prevPath) {
    return commitItemIconMap.addition;
  }

  return commitItemIconMap.modified;
};

export const createPathWithExt = p => {
  const ext = p.lastIndexOf('.') >= 0 ? p.substring(p.lastIndexOf('.') + 1) : '';

  return `${p.substring(1, p.lastIndexOf('.') + 1 || p.length)}${ext || '.js'}`;
};