Skip to content

Commit f92feed

Browse files
committed
add "service" property to response
with this property, the user will know in which service the zipcode was fetched
1 parent 5c7db83 commit f92feed

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

index.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ declare module 'cep-promise' {
44
state: string,
55
city: string,
66
street: string,
7-
neighborhood: string
7+
neighborhood: string,
8+
service: string
89
}
910

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

1516
export = cep
1617
}
17-
18-

src/services/correios.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ function extractValuesFromSuccessResponse (xmlObject) {
7171
state: xmlObject.uf,
7272
city: xmlObject.cidade,
7373
neighborhood: xmlObject.bairro,
74-
street: xmlObject.end
74+
street: xmlObject.end,
75+
service: 'correios',
7576
}
7677
}
7778

src/services/viacep.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ function extractCepValuesFromResponse (responseObject) {
4242
state: responseObject.uf,
4343
city: responseObject.localidade,
4444
neighborhood: responseObject.bairro,
45-
street: responseObject.logradouro
45+
street: responseObject.logradouro,
46+
service: 'viacep',
4647
}
4748
}
4849

src/services/widenet.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ function extractCepValuesFromResponse (object) {
4242
state: object.state,
4343
city: object.city,
4444
neighborhood: object.district,
45-
street: object.address
45+
street: object.address,
46+
service: 'widenet'
4647
}
4748
}
4849

0 commit comments

Comments
 (0)