A Node.js module to fetch and query postal codes from Ecuador.
npm install ecuador-postal-codes --save
yarn add ecuador-postal-codes
var ecuador = require('ecuador-postal-codes');
provinces
: Array of Province objectsprovincesArray
: Array of province nameslookupProvinces(<query>)
: Returns an array of Province objectslookupCities(<query>)
: Returns an array of City objectslookupTowns(<query>)
: Returns an array of Town objectslookupPostalCode(<query>)
: Returns a Town object that matches the postal code
var results = ecuador.data.lookupProvinces('GUAYAS');
Each Province object contains:
name
: Name of the province in uppercasecities
: Array of City objects.citiesArray
: Array of city names.lookupCities(<query>)
: Returns an array of City objectslookupTowns(<query>)
: Returns an array of Town objects
var results = ecuador.data.lookupCities('Quito');
Or you can searh within any province
var results = provinceObject.lookupCities('Quito');
Each City object contains:
name
: Name of the city in uppercaseprovince
: Province object referencetowns
: Array of Town objectstownsArray
: Array of town nameslookupTowns(<query>)
: Returns an array of Town objects
var results = ecuador.data.lookupCities('Tarqui');
Or you can searh within any city
var results = cityObject.lookupCities('Quito');
Each Town object contains:
name
: Name of the city in uppercasepostalCode
: Postal code of the city as stringcity
: City object referencepostalCodeAsNumber()
: Postal code of the city as number
Clone this repo, NPM-it and run the tests:
npm run test
Special thanks to @emamut for the data.