mirror of
https://github.com/lux-tel/session-desktop.git
synced 2026-10-30 20:33:24 +00:00
10 lines
405 B
TypeScript
10 lines
405 B
TypeScript
import { Constants } from '..';
|
|
|
|
/**
|
|
* returns at most Constants.CONVERSATION.MAX_SHORTENED_NAME_LENGTH (10 char)
|
|
* characters of the displayName, adds `…` if needed
|
|
*/
|
|
export function shortenDisplayName(displayName: string) {
|
|
return `${displayName.slice(0, Constants.CONVERSATION.MAX_SHORTENED_NAME_LENGTH)}${displayName.length > Constants.CONVERSATION.MAX_SHORTENED_NAME_LENGTH ? '…' : ''}`;
|
|
}
|