Skip to content

Commit

Permalink
fix(response): check if object exists in xml response by @chrisbenseler
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbenseler authored and filipedeschamps committed Sep 13, 2016
1 parent 0449d67 commit 3ae4996
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/cep-promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export default function (cepRawValue) {

if (addressValues) {
let addressObject = {
cep: addressValues['cep'][0],
state: addressValues['uf'][0],
city: addressValues['cidade'][0],
neighborhood: addressValues['bairro'][0],
street: addressValues['end'][0]
cep: _get(addressValues,'cep[0]'),
state: _get(addressValues,'uf[0]'),
city: _get(addressValues,'cidade[0]'),
neighborhood: _get(addressValues,'bairro[0]'),
street: _get(addressValues,'end[0]')
}

return addressObject
Expand All @@ -133,7 +133,7 @@ export default function (cepRawValue) {
function translateCorreiosMessages (message) {
let dictionary = {
'CEP NAO ENCONTRADO': 'CEP não encontrado na base dos Correios',
'BUSCA DEFINIDA COMO EXATA, 0 CEP DEVE TER 8 DIGITOS': 'CEP deve conter exatamente 8 caracteres'
'BUSCA DEFINIDA COMO EXATA, 0 CEP DEVE TER 8 DIGITOS': 'CEP deve conter exatamente ' + CEP_SIZE + ' caracteres'
}

return dictionary[message] || message
Expand Down Expand Up @@ -162,4 +162,4 @@ export default function (cepRawValue) {
}
}
})
}
}

0 comments on commit 3ae4996

Please sign in to comment.