Search Postal Code
npm install @postalcode/postalcodePackage Gateway for others gateway promises
PostalCode is currently extended with the following plugins.
Instructions on how to use them in your own application are linked below.
| Plugin | Country | README |
| -- | -- | -- |
| _ViaCep_ | BR | plugins/service-via-cep/README.md |
- Contribute for new plugins.
#### Browser using CDN
```
#### npm
``
$ npm install --save @postalcode/postalcode
#### yarn
``
$ yarn add @postalcode/postalcode
#### Typescript
`typescript
import { PostalCode } from "@postalcode/postalcode";
import ViaCepService, { ServiceOptions } from "@postalcode/service-viacep";
const postalCode = new PostalCode({
/ All Postal Code Options/
});
postCode.use
/ All Service Options/
});
postCode.get("05010000").then(console.log);
// {
// "postalcode": "05010000",
// "state": "SP",
// "city": "São Paulo",
// "street": "Rua Caiubí",
// "neighborhood": "Perdizes",
// }
`
#### Browser using CDN and plugins CDN
`html
`
`js``
{
//Filter plugins by country;
//default: get all postal code in all country plugins inputted in .use()
//ex: country:"BR" -> get postal code in "BR" country plugins inputted in .use()
//@type: string
country: "*",
//Postal Code length
//default: is 0, it captur automatic in plugins inserted in .use()
//@type: number
postalCodeSize:0,
//Set All plugins timeout.
//default: is 30s in milliseconds
//@type: number
timeout: 30000
}
Read our contribution guide here