Code & Deploy
siGit Code
Git Hosting
Toggle menu
siGit Code
Git Hosting
Sign in
Sign in
@devries-cameron20
/
t3code-1
Fork
0
The best way to control Claude Code, Codex and more from any computer or phone
t3code-1
/
packages
/
shared
/
src
/
String.ts
Code
Commits
Issues
Pulls
Cloud Agent
CICD
main
main
ts
9 lines
263 Bytes
Copy permalink
Copy
Raw
1
export
function
truncate
(
text
:
string
,
maxLength
=
50
):
string
{
2
const
trimmed
=
text
.
trim
();
3
const
characters
=
Array
.
from
(
trimmed
);
4
if
(
characters
.
length
<=
maxLength
)
{
5
return
trimmed
;
6
}
7
8
return
`
${
characters
.
slice
(
0
,
maxLength
).
join
(
""
)}
...`
;
9
}