MCPcopy Create free account
hub / github.com/xerrors/Yuxi / getPreviewFileExtension

Function getPreviewFileExtension

web/src/utils/file_preview.js:78–88  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

76}
77
78export const getPreviewFileExtension = (path) => {
79 const normalizedPath = String(path || '')
80 .trim()
81 .toLowerCase()
82 if (!normalizedPath) return ''
83
84 const fileName = normalizedPath.split('/').pop() || ''
85 const dotIndex = fileName.lastIndexOf('.')
86 if (dotIndex <= 0) return ''
87 return fileName.slice(dotIndex)
88}
89
90export const isMarkdownPreview = (path, previewType) => {
91 if (previewType === 'markdown') return true

Callers 5

getFileExtensionLabelFunction · 0.90
isMarkdownPreviewFunction · 0.85
getPreviewTypeByPathFunction · 0.85
getCodeLanguageByPathFunction · 0.85
isHtmlPreviewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected