MCPcopy
hub / github.com/subnub/myDrive / getFileExtension

Function getFileExtension

src/utils/files.ts:1–16  ·  view source on GitHub ↗
(filename: string, length = 4)

Source from the content-addressed store, hash-verified

1export const getFileExtension = (filename: string, length = 4) => {
2 const filenameSplit = filename.split(".");
3
4 if (filenameSplit.length > 1) {
5 let extension = filenameSplit[filenameSplit.length - 1];
6
7 if (extension.length > length)
8 extension =
9 extension.substring(0, length - 1) +
10 extension.substring(extension.length - 1, extension.length);
11
12 return extension.toUpperCase();
13 } else {
14 return "UNK";
15 }
16};
17
18type ColorMap = {
19 [key: string]: string;

Callers 9

SharePopup.tsxFile · 0.90
FileItem.tsxFile · 0.90
SearchBarItemFunction · 0.90
FileInfoPopupFunction · 0.90
PublicDownloadPageFunction · 0.90
RightSection.tsxFile · 0.90
getFileColorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected