2018-07-26 14:56:56 +00:00
|
|
|
import { commitItemIconMap } from './constants';
|
|
|
|
|
|
|
|
export const getCommitIconMap = file => {
|
|
|
|
if (file.deleted) {
|
|
|
|
return commitItemIconMap.deleted;
|
|
|
|
} else if (file.tempFile) {
|
|
|
|
return commitItemIconMap.addition;
|
|
|
|
}
|
|
|
|
|
|
|
|
return commitItemIconMap.modified;
|
|
|
|
};
|
2018-06-13 16:06:35 +00:00
|
|
|
|
|
|
|
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'}`;
|
|
|
|
};
|