We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7ddd24 commit 4dd510dCopy full SHA for 4dd510d
frontend/src/utils/truncate.ts
@@ -1,9 +1,9 @@
1
-export function truncate(str: string, maxLength: number): string {
2
- const trimmed = str.trimEnd();
+export const truncate = (text: string, maxLength: number = 50): string => {
+ const trimmed = text.trimEnd();
3
4
if (trimmed.length <= maxLength) {
5
return trimmed;
6
}
7
8
return trimmed.slice(0, maxLength).trimEnd() + '…';
9
-}
+};
0 commit comments