2018-11-18 11:00:15 +05:30
|
|
|
import { commitItemIconMap } from './constants';
|
|
|
|
|
|
|
|
export const getCommitIconMap = file => {
|
|
|
|
if (file.deleted) {
|
|
|
|
return commitItemIconMap.deleted;
|
2019-09-30 21:07:59 +05:30
|
|
|
} else if (file.tempFile && !file.prevPath) {
|
2018-11-18 11:00:15 +05:30
|
|
|
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'}`;
|
|
|
|
};
|