aboutsummaryrefslogtreecommitdiff
path: root/src/utils/string.ts
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2022-01-26 12:58:33 -0500
committerMax Isom <[email protected]>2022-01-26 12:58:33 -0500
commitaacb107f43db6b8c53d160b5913701959f81cf09 (patch)
treea63d0717d03c84987b69d5af1c1f5b45ef019a4a /src/utils/string.ts
parent09665af53ee1b1903fc9ea719722aa5dfdc26325 (diff)
parentaf05210be4a8857ea707866192efa79b3945b314 (diff)
downloadmuse-aacb107f43db6b8c53d160b5913701959f81cf09.tar.xz
muse-aacb107f43db6b8c53d160b5913701959f81cf09.zip
Merge branch 'master' into feature/slash-commands
Diffstat (limited to 'src/utils/string.ts')
-rw-r--r--src/utils/string.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/utils/string.ts b/src/utils/string.ts
new file mode 100644
index 0000000..0b49114
--- /dev/null
+++ b/src/utils/string.ts
@@ -0,0 +1,2 @@
+export const truncate = (text: string, maxLength = 50) =>
+ text.length > maxLength ? `${text.slice(0, maxLength - 3)}...` : text;