20 lines
558 B
TypeScript
20 lines
558 B
TypeScript
export function formatEuAddress(street: string, city: string, regionName: string): string {
|
|
return `${street}, ${city}, ${regionName}, EU`;
|
|
}
|
|
|
|
export function formatAddress(options: {
|
|
isEuResident: boolean;
|
|
street?: string | null;
|
|
city?: string | null;
|
|
regionName?: string | null;
|
|
customAddress?: string | null;
|
|
}): string {
|
|
const { isEuResident, street, city, regionName, customAddress } = options;
|
|
|
|
if (isEuResident && street && city && regionName) {
|
|
return formatEuAddress(street, city, regionName);
|
|
}
|
|
|
|
return customAddress ?? "";
|
|
}
|