@bcredi/postalcode
v0.3.0
Published
A JavaScript library to interface with postal code API
Downloads
18
Keywords
Readme
Postal Code JS Library
A JavaScript library to interface with Postal Code API.
Description
This library covers all your needs for integrating with Postal Code API, providing:
- A clean Promise-based interface
- Postal code validations (type and length)
Installation
yarn add @bcredi/postalcode --save
How to use
ES6
Import like usual:
import postalcode from '@bcredi/postalcode';
postalcode('81050200').then(console.log);
// "data": {
// "abbreviation": "R Pedro Gusso",
// "city": "Curitiba",
// "complement": "- até 1384/1385",
// "name": "Pedro Gusso",
// "neighborhood": "Novo Mundo",
// "postal_code": 81050200,
// "state": "PR",
// "type": "Rua"
// }
UMD in Browser
You can also use the latest release from our CDN and import the build directly in your HTML:
<script src="http://cdn.jsdelivr.net/npm/@bcredi/postalcode@latest" />
The library will be available as the global variable postalcode
.
Building
To build the library, use npm dev
.
Testing
To run the library tests, use npm test
.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
The MIT License (MIT)
Copyright (c) 2019 Bcredi Serviços de Crédito e Cobrança S.A.