MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / truncateFilename

Function truncateFilename

cli/src/components/image-card.tsx:21–30  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

19const INLINE_IMAGE_HEIGHT = 3
20
21const truncateFilename = (filename: string): string => {
22 if (filename.length <= MAX_FILENAME_LENGTH) {
23 return filename
24 }
25 const lastDot = filename.lastIndexOf('.')
26 const ext = lastDot !== -1 ? filename.slice(lastDot) : ''
27 const baseName = lastDot !== -1 ? filename.slice(0, lastDot) : filename
28 const maxBaseLength = MAX_FILENAME_LENGTH - ext.length - 1 // -1 for ellipsis
29 return baseName.slice(0, maxBaseLength) + '…' + ext
30}
31
32export interface ImageCardImage {
33 path: string

Callers 1

ImageCardFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected