MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / filterFileName

Function filterFileName

frontend/src/tools/fileManager.ts:27–37  ·  view source on GitHub ↗
(fileName: string, onlyExtname = false)

Source from the content-addressed store, hash-verified

25} from "@ant-design/icons-vue";
26
27export const filterFileName = (fileName: string, onlyExtname = false) => {
28 const i = fileName.lastIndexOf(".");
29 const suffix = fileName.substring(i + 1).toUpperCase();
30 return i === -1
31 ? onlyExtname
32 ? "UNKNOWN"
33 : t("TXT_CODE_d4cf1cb8")
34 : onlyExtname
35 ? suffix
36 : `${suffix} ${t("TXT_CODE_d4cf1cb8")}`;
37};
38
39export const getFileExtName = (fileName: string) => {
40 if (fileName.indexOf(".") === -1) return "";

Callers 1

getFileIconFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected