MCPcopy
hub / github.com/npmx-dev/npmx.dev / applyEllipsis

Function applyEllipsis

app/utils/charts.ts:875–886  ·  view source on GitHub ↗
(text: string, maxLength = 45)

Source from the content-addressed store, hash-verified

873}
874
875export function applyEllipsis(text: string, maxLength = 45) {
876 if (typeof text !== 'string') {
877 return ''
878 }
879 if (!Number.isInteger(maxLength) || maxLength <= 0) {
880 return text
881 }
882 if (text.length <= maxLength) {
883 return text
884 }
885 return text.slice(0, maxLength) + '...'
886}
887
888/**
889 * Constants shared among chart components using seeded patterns with the <VueUiPatternSeed> component.

Callers 2

charts.spec.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected