-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
15,160 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github: [rfoel] | ||
patreon: rfoel | ||
open_collective: rfoel | ||
ko_fi: rfoel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: '/' | ||
schedule: | ||
interval: daily | ||
time: '08:00' | ||
open-pull-requests-limit: 10 | ||
target-branch: develop | ||
commit-message: | ||
prefix: fix | ||
prefix-development: chore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Develop | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
develop: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- run: npm install | ||
- run: npm test | ||
- run: npm run lint | ||
- run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- run: npm install | ||
- run: npm test | ||
- run: npm run lint | ||
- run: npm run build | ||
- run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"branches": [ | ||
"main" | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
[ | ||
"@semantic-release/npm", | ||
{ | ||
"tarballDir": "release" | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"assets": "release/*.tgz" | ||
} | ||
], | ||
"@semantic-release/git" | ||
], | ||
"preset": "angular" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,92 @@ | ||
# viacep | ||
|
||
[![npm](https://img.shields.io/npm/v/viacep)](https://www.npmjs.com/viacep) | ||
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/viacep)](https://www.npmjs.com/viacep) | ||
[![NPM](https://img.shields.io/npm/l/viacep)](LICENSE) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
|
||
Procurando um webservice gratuito e de alto desempenho para consultar Códigos de Endereçamento Postal (CEP) do Brasil? Utilize o serviço, melhore a qualidade de suas aplicações web e colabore para manter esta base de dados atualizada. Mais informações no [site oficial](https://viacep.com.br/). | ||
|
||
## Instalação | ||
|
||
Para instalar o pacote rode: | ||
|
||
``` | ||
npm install viacep | ||
``` | ||
|
||
ou | ||
|
||
``` | ||
yarn add viacep | ||
``` | ||
|
||
## Início rápido | ||
|
||
```js | ||
import { viacep } from 'viacep' | ||
|
||
const viacep = new viacep() | ||
|
||
;(async () => { | ||
try { | ||
const data = await viacep.cep('01001-000') | ||
console.log(data) | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
})() | ||
``` | ||
|
||
## Métodos disponíveis | ||
|
||
### CEP | ||
|
||
Busca por endereço pelo número do CEP. | ||
|
||
```js | ||
viacep.cep('01001-000') | ||
|
||
// { | ||
// cep: '01310-000', | ||
// logradouro: 'Avenida Paulista', | ||
// complemento: 'até 610 - lado par', | ||
// bairro: 'Bela Vista', | ||
// localidade: 'São Paulo', | ||
// uf: 'SP', | ||
// ibge: '3550308', | ||
// gia: '1004', | ||
// ddd: '11', | ||
// siafi: '7107' | ||
// } | ||
``` | ||
|
||
Também existe um overload para encontrar endereços a partir de estado, cidade e rua. O retorno desse método é uma array de endereços. | ||
|
||
```js | ||
viacep.cep({ state: 'SP', city: 'São Paulo', street: 'Praça da Sé' }) | ||
|
||
// [ | ||
// { | ||
// cep: '01001-000', | ||
// logradouro: 'Praça da Sé', | ||
// complemento: 'lado ímpar', | ||
// bairro: 'Sé', | ||
// localidade: 'São Paulo', | ||
// uf: 'SP', | ||
// ibge: '3550308', | ||
// gia: '1004', | ||
// ddd: '11', | ||
// siafi: '7107' | ||
// }, | ||
// ... | ||
// ] | ||
``` | ||
|
||
## Contribuindo | ||
|
||
Issues e Pull requests são bem-vindos. | ||
|
||
## Licença | ||
|
||
[MIT](https://github.com/rfoel/viacep/blob/main/LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
globals: { | ||
'ts-jest': { | ||
diagnostics: false, | ||
}, | ||
}, | ||
testMatch: ['**/tests/*.test.ts'], | ||
} |
Oops, something went wrong.