Remove 6 componentes não utilizados (dashboard-grid, expenses/income by category widgets, installment analysis panels, fatura-warning-dialog). Remove funções/tipos não utilizados: successResult, generateApiToken, validateApiToken, getTodayUTC/Local, formatDateForDb, getDateInfo, calculatePercentage, roundToDecimals, safeParseInt/Float, isPeriodValid, getLastPeriods, normalizeWhitespace, formatCurrency wrapper, InboxItemInput, InboxBatchInput, ProcessInboxInput, DiscardInboxInput, LancamentosColumnId, 5 funções de anticipation-helpers. Redireciona imports de formatCurrency para lib/lancamentos/formatting-helpers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
977 B
TypeScript
35 lines
977 B
TypeScript
/**
|
|
* Utility functions for string normalization and manipulation
|
|
*/
|
|
|
|
/**
|
|
* Normalizes optional string - trims and returns null if empty
|
|
* @param value - String to normalize
|
|
* @returns Trimmed string or null if empty
|
|
*/
|
|
export function normalizeOptionalString(
|
|
value: string | null | undefined,
|
|
): string | null {
|
|
const trimmed = value?.trim() ?? "";
|
|
return trimmed.length > 0 ? trimmed : null;
|
|
}
|
|
|
|
/**
|
|
* Normalizes file path by extracting filename
|
|
* @param path - File path to normalize
|
|
* @returns Filename without path
|
|
*/
|
|
export function normalizeFilePath(path: string | null | undefined): string {
|
|
return path?.split("/").filter(Boolean).pop() ?? "";
|
|
}
|
|
|
|
/**
|
|
* Normalizes icon input - trims and returns null if empty
|
|
* @param icon - Icon string to normalize
|
|
* @returns Trimmed icon string or null
|
|
*/
|
|
export function normalizeIconInput(icon?: string | null): string | null {
|
|
const trimmed = icon?.trim() ?? "";
|
|
return trimmed.length > 0 ? trimmed : null;
|
|
}
|