a0201e17b9
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
20 lines
590 B
TypeScript
20 lines
590 B
TypeScript
/**
|
|
* Truncates a description string to a maximum character length.
|
|
* If truncated, appends "..." to indicate continuation.
|
|
*
|
|
* @param description - The description string to truncate
|
|
* @param maxLength - Maximum character length (default: 120)
|
|
* @returns Truncated description with "..." appended if it was truncated
|
|
*/
|
|
export function truncateDescription(description: string, maxLength: number = 120): string {
|
|
if (!description) {
|
|
return description
|
|
}
|
|
|
|
if (description.length <= maxLength) {
|
|
return description
|
|
}
|
|
|
|
return description.slice(0, maxLength) + "..."
|
|
}
|