@grafana/ui
Version:
Grafana Components Library
1 lines • 944 B
Source Map (JSON)
{"version":3,"file":"file.mjs","sources":["../../../src/utils/file.ts"],"sourcesContent":["/**\n * Shortens the filename to 16 length\n * @param fileName\n */\nexport function trimFileName(fileName: string): string {\n const nameLength = 16;\n const delimiter = fileName.lastIndexOf('.');\n const extension = fileName.substring(delimiter);\n const file = fileName.substring(0, delimiter);\n\n if (file.length < nameLength) {\n return fileName;\n }\n\n return `${file.substring(0, nameLength)}...${extension}`;\n}\n"],"names":[],"mappings":";AAIO,SAAS,aAAa,QAAA,EAA0B;AACrD,EAAA,MAAM,UAAA,GAAa,EAAA;AACnB,EAAA,MAAM,SAAA,GAAY,QAAA,CAAS,WAAA,CAAY,GAAG,CAAA;AAC1C,EAAA,MAAM,SAAA,GAAY,QAAA,CAAS,SAAA,CAAU,SAAS,CAAA;AAC9C,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,SAAA,CAAU,CAAA,EAAG,SAAS,CAAA;AAE5C,EAAA,IAAI,IAAA,CAAK,SAAS,UAAA,EAAY;AAC5B,IAAA,OAAO,QAAA;AAAA,EACT;AAEA,EAAA,OAAO,GAAG,IAAA,CAAK,SAAA,CAAU,GAAG,UAAU,CAAC,MAAM,SAAS,CAAA,CAAA;AACxD;;;;"}