Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

feat(postcodes): expose postcodes array in suggestions #622

Merged
merged 3 commits into from
Oct 30, 2018

Conversation

JonathanMontane
Copy link
Contributor

Summary

This PR exposes the postcodes array in the suggestion object.
It now also returns the best matching postcode as postcode when possible.
the postcode field is now also included in the highlight object.

Result

  • exposes the postcodes field

  • updates tests to include postcodes array

  • updates the documentation to include section about postcodes
    image

  • update landing formatting with new postcodes object (truncated for readability)

image


Examples:

- `["94102","94103","94104",...]`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format with spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now is:

image

which was the way I felt it rendered the best

- city
- postcode
- county
- administrative
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -83,7 +121,8 @@ export default function formatHit({
lat: hit._geoloc.lat,
lng: hit._geoloc.lng,
},
postcode: hit.postcode && hit.postcode[0],
postcode,
postcodes: hit.postcode ? hit.postcode : undefined,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be postcodes: hit.postcodes ? hit.postcodes : undefined,?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The raw response field for the postcode array is postcode, so it's not a typo!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice catch 👍

@JonathanMontane
Copy link
Contributor Author

Let me know what you think of the formatting changes @raphi

@JonathanMontane JonathanMontane merged commit 870e08a into master Oct 30, 2018
@JonathanMontane JonathanMontane deleted the feat/postcodes branch October 30, 2018 14:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants