| 1 | /** |
| 2 | * A project's description: what it is, in a line. Only projects have |
| 3 | * descriptions; a repository has none of its own. |
| 4 | */ |
| 5 | |
| 6 | /** The longest description a project keeps. */ |
| 7 | export const MAX_DESCRIPTION = 200; |
| 8 | |
| 9 | /** |
| 10 | * The description to store for a change: unchanged when none is given, |
| 11 | * null (none) for null or blank text, otherwise the text. |
| 12 | */ |
| 13 | export function ownDescription(current: string | null, change: string | null | undefined): string | null { |
| 14 | if (change === undefined) return current; |
| 15 | const text = change?.trim() ?? ""; |
| 16 | return text ? text.slice(0, MAX_DESCRIPTION) : null; |
| 17 | } |