Adding a test for undefined addresses
This commit is contained in:
parent
229bc14f72
commit
ba14181bdd
|
@ -36,8 +36,10 @@ export const getVillageOrTown = (address: any) => {
|
||||||
'locality',
|
'locality',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (!address || !address.address) return '';
|
||||||
|
|
||||||
for (let synonym of citySynonyms) {
|
for (let synonym of citySynonyms) {
|
||||||
// console.log({ caller: 'getVillageOrTown', address, synonym });
|
// console.log({ caller: 'getVillageOrTown', address, synonym });
|
||||||
if (synonym in address?.address) {
|
if (synonym in address?.address) {
|
||||||
return address?.address[synonym];
|
return address?.address[synonym];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue