mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
20fb79567f
* fix: project states fixes * fix: states fixes * fix: formating all files
22 lines
544 B
TypeScript
22 lines
544 B
TypeScript
export const getFileExtension = (filename: string) => filename.slice(((filename.lastIndexOf(".") - 1) >>> 0) + 2);
|
|
|
|
export const getFileName = (fileName: string) => {
|
|
const dotIndex = fileName.lastIndexOf(".");
|
|
|
|
const nameWithoutExtension = fileName.substring(0, dotIndex);
|
|
|
|
return nameWithoutExtension;
|
|
};
|
|
|
|
export const convertBytesToSize = (bytes: number) => {
|
|
let size;
|
|
|
|
if (bytes < 1024 * 1024) {
|
|
size = Math.round(bytes / 1024) + " KB";
|
|
} else {
|
|
size = Math.round(bytes / (1024 * 1024)) + " MB";
|
|
}
|
|
|
|
return size;
|
|
};
|