From 9ec16783b42e8db8f574e4872b22b3e1684ef635 Mon Sep 17 00:00:00 2001 From: mgtennant <100305096+mgtennant@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:58:18 -0700 Subject: [PATCH] there was already a ticdi-45 fix --- frontend/utils/util.ts | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/frontend/utils/util.ts b/frontend/utils/util.ts index d997a724..064417c1 100644 --- a/frontend/utils/util.ts +++ b/frontend/utils/util.ts @@ -33,7 +33,7 @@ export function formatPostalCode(value: string) { * */ export function nfrAddressBuilder(tenantAddr: any[]): string { - const formattedAddresses: string[] = [] + const formattedAddresses: string[] = []; for (const addressObj of tenantAddr) { const { legalName, @@ -47,10 +47,9 @@ export function nfrAddressBuilder(tenantAddr: any[]): string { provAbbr, postalCode, } = addressObj; - console.log(addressObj) + const formattedAddress: string[] = []; let name = null; - if (legalName) { name = legalName; } else if (firstName || middleName || lastName) { @@ -60,16 +59,6 @@ export function nfrAddressBuilder(tenantAddr: any[]): string { ); name = filteredParts.join(" "); } - let addrLines = ''; - if (addrLine1 && addrLine1.length > 0) { - addrLines = addrLine1; - } - if (addrLine2 && addrLine2.length > 0) { - addrLines = [addrLines, addrLine2].join('\n'); - } - if (addrLine3 && addrLine3.length > 0) { - addrLines = [addrLines, addrLine3].join('\n'); - } const parts = []; if (city) { @@ -83,8 +72,12 @@ export function nfrAddressBuilder(tenantAddr: any[]): string { } const address = parts.join(" "); - // combine name, addrLines, and address - formattedAddresses.push([name, addrLines, address].join('\n')); + formattedAddress.push(name); + if (addrLine1) formattedAddress.push(addrLine1); + if (addrLine2) formattedAddress.push(addrLine2); + if (addrLine3) formattedAddress.push(addrLine3); + formattedAddress.push(address); + formattedAddresses.push(formattedAddress.join("\n")); } return formattedAddresses.join("\n"); }