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

Function truncateToLines

cli/src/components/choice-ad-banner.tsx:22–27  ·  view source on GitHub ↗
(text: string, lineWidth: number, maxLines: number)

Source from the content-addressed store, hash-verified

20const MIN_CARD_WIDTH = 60 // Minimum width per ad card to remain readable
21
22function truncateToLines(text: string, lineWidth: number, maxLines: number): string {
23 if (lineWidth <= 0) return text
24 const maxChars = lineWidth * maxLines
25 if (text.length <= maxChars) return text
26 return text.slice(0, maxChars - 1) + '…'
27}
28
29function truncateToWidth(text: string, width: number): string {
30 if (width <= 0) return ''

Callers 1

ChoiceAdBannerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected