cepaberto

    1.0.0 • Public • Published

    CEP Aberto JavaScript SDK

    Build Status Coverage Status

    This is the JavaScript SDK for the CEP Aberto API to search for addresses and zipcodes directly from your JS application.

    CEP Aberto is an Open Database Project that provides a free of charge zipcode database and a simple API that allows you to fetch the information on-the-fly.

    Installation

    $ npm install --save cepaberto
    

    Usage

    Importing the library to your code:

    const CEPAberto = require('cepaberto')
     
    let cepaberto = new CEPAberto()

    Find address by zipcode

    cepaberto.findByCode('30180-000')
             .then((address) => console.log(address))
             .catch((err) => console.error(err))

    If the address was not found, the address variable will be a boolean false.

    Find address by coordinates

    cepaberto.findByCoordinates('-40.9182391','-12.0918236')
             .then((address) => console.log(address))
             .catch((err) => console.error(err))

    Find zipcode by address

    cepaberto.findByAddress('MG', 'Belo Horizonte', 'Centro', 'Av. Amazonas')
             .then((address) => console.log(address))
             .catch((err) => console.error(err))

    Only the state and city parameters are mandatory because some zipcodes represents an entire city.

    Find cities

    cepaberto.findCities('MG')
             .then((cities) => console.log(cities))
             .catch((err) => console.error(err))

    Tests

    $ npm test
    

    License

    This library is licensed under the MIT license.

    Install

    npm i cepaberto

    DownloadsWeekly Downloads

    4

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • devsdmf