feat(flight-finder): implement milestone M2 - report workflow and delivery gates
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
export function normalizeMarketCountry(
|
||||
value: string | null | undefined
|
||||
): string | null | undefined {
|
||||
const cleaned = typeof value === "string" ? value.trim() : undefined;
|
||||
if (!cleaned) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const normalized = cleaned.toUpperCase();
|
||||
if (!/^[A-Z]{2}$/.test(normalized)) {
|
||||
throw new Error(
|
||||
`Invalid marketCountry "${value}". Use an ISO 3166-1 alpha-2 uppercase country code such as "TH" or "DE".`
|
||||
);
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export function isPlausibleEmail(value: string | null | undefined): boolean {
|
||||
if (!value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
||||
}
|
||||
Reference in New Issue
Block a user