MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / truncate

Function truncate

packages/utilities/src/string.ts:14–19  ·  view source on GitHub ↗
(text: string, limit: number)

Source from the content-addressed store, hash-verified

12}
13
14export function truncate(text: string, limit: number): string {
15 if (text.length > limit) {
16 return `${text.substring(0, limit)}...`;
17 }
18 return text;
19}
20
21export function random(): string {
22 return (Math.random() * 100000000000).toString();

Callers 3

string.spec.tsFile · 0.90
CommunityCardFunction · 0.90
getTitleFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected