refactor(geschichte): remove JSDoc what-comments from utils.ts
Function names already communicate intent. Comments that restate the function name add noise without explaining why. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,22 +3,16 @@ import { formatDate } from '$lib/shared/utils/date';
|
|||||||
type AuthorSummary = { firstName?: string; lastName?: string; email: string };
|
type AuthorSummary = { firstName?: string; lastName?: string; email: string };
|
||||||
type AuthorView = { displayName: string };
|
type AuthorView = { displayName: string };
|
||||||
|
|
||||||
/** Format an author name from a list summary (firstName + lastName, falling back to email). */
|
|
||||||
export function formatAuthorName(author: AuthorSummary | null | undefined): string {
|
export function formatAuthorName(author: AuthorSummary | null | undefined): string {
|
||||||
if (!author) return '';
|
if (!author) return '';
|
||||||
const full = [author.firstName, author.lastName].filter(Boolean).join(' ').trim();
|
const full = [author.firstName, author.lastName].filter(Boolean).join(' ').trim();
|
||||||
return full || author.email || '';
|
return full || author.email || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Format an author displayName from a detail view. */
|
|
||||||
export function formatAuthorDisplayName(author: AuthorView | null | undefined): string {
|
export function formatAuthorDisplayName(author: AuthorView | null | undefined): string {
|
||||||
return author?.displayName ?? '';
|
return author?.displayName ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Format a publishedAt ISO string to a localised date string.
|
|
||||||
* Returns null when publishedAt is absent.
|
|
||||||
*/
|
|
||||||
export function formatPublishedAt(
|
export function formatPublishedAt(
|
||||||
publishedAt: string | null | undefined,
|
publishedAt: string | null | undefined,
|
||||||
style: 'short' | 'long' = 'short'
|
style: 'short' | 'long' = 'short'
|
||||||
|
|||||||
Reference in New Issue
Block a user