Skip to content

Commit

Permalink
feat(DTFS2-7052): tidying up map function
Browse files Browse the repository at this point in the history
  • Loading branch information
avaitonis committed May 13, 2024
1 parent 18fdf4a commit 0da25c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/modules/geospatial/geospatial.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export class GeospatialService {
response.results.forEach((item) => {
// Item can have key DPA or LPI, so we get data dynamically, even if we expect key to always be DPA.
const item_data = item[Object.keys(item)[0]];
// Filter out empty values and join values with single space.
const addressLine1 = [item_data.BUILDING_NAME, item_data.BUILDING_NUMBER, item_data.THOROUGHFARE_NAME].filter(Boolean).join(' ');
addresses.push({
organisationName: item_data.ORGANISATION_NAME || null,
// Filter out empty values and join values with single space.
addressLine1: [item_data.BUILDING_NAME, item_data.BUILDING_NUMBER, item_data.THOROUGHFARE_NAME].filter(Boolean).join(' '),
addressLine1,
addressLine2: item_data.DEPENDENT_LOCALITY || null,
addressLine3: null,
locality: item_data.POST_TOWN || null,
Expand Down

0 comments on commit 0da25c3

Please sign in to comment.