This commit is contained in:
Fredrik Burmester
2024-08-12 19:38:17 +02:00
parent 040ef3b79a
commit d5ee79d740
4 changed files with 25 additions and 10 deletions

7
utils/textTools.ts Normal file
View File

@@ -0,0 +1,7 @@
/*
* Truncate a text longer than a certain length
*/
export const tc = (text: string | null | undefined, length: number = 20) => {
if (!text) return "";
return text.length > length ? text.substr(0, length) + "..." : text;
};