debian-mirror-gitlab/app/assets/javascripts/ide/utils.js
2019-09-30 21:07:59 +05:30

17 lines
492 B
JavaScript

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'}`;
};