mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-10-19 03:45:03 +02:00
10 lines
257 B
TypeScript
10 lines
257 B
TypeScript
|
export const trimStringToFixedLength = (value: string, maxLength: number) => {
|
||
|
if (maxLength < 1) {
|
||
|
throw new Error('max length must be positive');
|
||
|
}
|
||
|
|
||
|
return value.length > maxLength
|
||
|
? value.substring(0, maxLength - 3) + '...'
|
||
|
: value;
|
||
|
};
|