diff options
| author | Fuwn <[email protected]> | 2024-02-02 04:12:16 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-02-02 04:12:16 -0800 |
| commit | 4319f04d15fea1ec610cde51648709ae3d77248b (patch) | |
| tree | 8cc3382eded31482e6d22792e4a1068465eaf6ca /src/lib/Utility/string.ts | |
| parent | fix(schedule): use non-custom cover width (diff) | |
| download | due.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.ts | 2 |
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; |