File size: 469 Bytes
1dbc34b
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export type SummaryValue = string | null | undefined;

/**
 * Returns the first summary candidate that contains non-whitespace content.
 * The original string is returned (without trimming) to preserve formatting.
 */
export function getFirstNonEmptySummary(...candidates: SummaryValue[]): string | null {
  for (const candidate of candidates) {
    if (typeof candidate === 'string' && candidate.trim().length > 0) {
      return candidate;
    }
  }
  return null;
}