aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Utility/string.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-02-02 04:12:16 -0800
committerFuwn <[email protected]>2024-02-02 04:12:16 -0800
commit4319f04d15fea1ec610cde51648709ae3d77248b (patch)
tree8cc3382eded31482e6d22792e4a1068465eaf6ca /src/lib/Utility/string.ts
parentfix(schedule): use non-custom cover width (diff)
downloaddue.moe-4319f04d15fea1ec610cde51648709ae3d77248b.tar.xz
due.moe-4319f04d15fea1ec610cde51648709ae3d77248b.zip
feat(schedule): shorten long titles
Diffstat (limited to 'src/lib/Utility/string.ts')
-rw-r--r--src/lib/Utility/string.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/Utility/string.ts b/src/lib/Utility/string.ts
new file mode 100644
index 00000000..8cfc4ee5
--- /dev/null
+++ b/src/lib/Utility/string.ts
@@ -0,0 +1,2 @@
+export const abbreviate = (title: string, maxLength: number) =>
+ title.length > maxLength ? `${title.slice(0, maxLength)}...` : title;