Skip to content

Simple Node library to fetch and lookup Ecuador's provinces, cities, towns and postal codes

License

Notifications You must be signed in to change notification settings

po5i/ecuador-postal-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

ecuador-postal-codes

A Node.js module to fetch and query postal codes from Ecuador.

Installation

npm install ecuador-postal-codes --save
yarn add ecuador-postal-codes

Usage

var ecuador = require('ecuador-postal-codes');

Members

  • provinces: Array of Province objects
  • provincesArray: Array of province names
  • lookupProvinces(<query>): Returns an array of Province objects
  • lookupCities(<query>): Returns an array of City objects
  • lookupTowns(<query>): Returns an array of Town objects
  • lookupPostalCode(<query>): Returns a Town object that matches the postal code

Search provinces example

var results = ecuador.data.lookupProvinces('GUAYAS');

Province members

Each Province object contains:

  • name: Name of the province in uppercase
  • cities: Array of City objects.
  • citiesArray: Array of city names.
  • lookupCities(<query>): Returns an array of City objects
  • lookupTowns(<query>): Returns an array of Town objects

Search cities examples

var results = ecuador.data.lookupCities('Quito');

Or you can searh within any province

var results = provinceObject.lookupCities('Quito');

City members

Each City object contains:

  • name: Name of the city in uppercase
  • province: Province object reference
  • towns: Array of Town objects
  • townsArray: Array of town names
  • lookupTowns(<query>): Returns an array of Town objects

Search towns (AKA parroquias) examples

var results = ecuador.data.lookupCities('Tarqui');

Or you can searh within any city

var results = cityObject.lookupCities('Quito');

Town members

Each Town object contains:

  • name: Name of the city in uppercase
  • postalCode: Postal code of the city as string
  • city: City object reference
  • postalCodeAsNumber(): Postal code of the city as number

Contribute

Clone this repo, NPM-it and run the tests:

npm run test

Thanks

Special thanks to @emamut for the data.

About

Simple Node library to fetch and lookup Ecuador's provinces, cities, towns and postal codes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published