mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-06-08 07:53:57 +02:00
refactor: trim long browser and profile names
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Trims a name to a maximum length and adds ellipsis if needed
|
||||
* @param name The name to trim
|
||||
* @param maxLength Maximum length before truncation (default: 30)
|
||||
* @returns Trimmed name with ellipsis if truncated
|
||||
*/
|
||||
export function trimName(name: string, maxLength: number = 30): string {
|
||||
return name.length > maxLength ? `${name.substring(0, maxLength)}...` : name;
|
||||
}
|
||||
Reference in New Issue
Block a user