Skip to content

Commit

Permalink
add "service" property to response
Browse files Browse the repository at this point in the history
with this property, the user will know in which service the zipcode was
fetched
  • Loading branch information
murilohns committed Jun 10, 2020
1 parent 5c7db83 commit f92feed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ declare module 'cep-promise' {
state: string,
city: string,
street: string,
neighborhood: string
neighborhood: string,
service: string
}

// this workarround is because this : https://github.com/Microsoft/TypeScript/issues/5073
Expand All @@ -14,5 +15,3 @@ declare module 'cep-promise' {

export = cep
}


3 changes: 2 additions & 1 deletion src/services/correios.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ function extractValuesFromSuccessResponse (xmlObject) {
state: xmlObject.uf,
city: xmlObject.cidade,
neighborhood: xmlObject.bairro,
street: xmlObject.end
street: xmlObject.end,
service: 'correios',
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/services/viacep.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ function extractCepValuesFromResponse (responseObject) {
state: responseObject.uf,
city: responseObject.localidade,
neighborhood: responseObject.bairro,
street: responseObject.logradouro
street: responseObject.logradouro,
service: 'viacep',
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/services/widenet.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ function extractCepValuesFromResponse (object) {
state: object.state,
city: object.city,
neighborhood: object.district,
street: object.address
street: object.address,
service: 'widenet'
}
}

Expand Down

0 comments on commit f92feed

Please sign in to comment.