Country Dictionary
Node.JS Country Descriptor
This modules allows you to grab information about any country (cities, languages spoken, phone index, ...etc).
Installation
$ npm install country-dictionary
Example Code
var _ = require('underscore');
var countryDict = require('country-dictionary')();
countryDict.setGMapsAPIKey('<API Key>');
var CountryDict = require('country-dictionary');
var countryDict = new CountryDict({
GMapsApiKey: '<API Key>'
});
var countries = countryDict.getAllCountries();
var country = countryDict.getCountryByName('France');
countryDict.getCities('France', 100, function(error, cities){
console.log("Found Cities: " + JSON.stringify(cities));
})
var country = countryDict.getCountryByPhoneIndex('49');
countryDict.getCountryByAddress('1600 Amphitheatre Pkwy, Mountain View', function(error, country){
console.log("Found Country: " + country)
});
var capital = countryDict.getCapital('Mexico');
var languages = countryDict.getLanguages('Mexico');
countryDict.getCountriesByLanguage('arabic', function(error, countries){
_.each(_.pluck(countries, 'name'), function(country){
console.log("country: " + country);
});
});
countryDict.getCountriesByCurrency('EUR', function(error, countries){
_.each(_.pluck(countries, 'name'), function(country){
console.log("country: " + country);
});
});
countryDict.getCountriesByContinent('EU', function(error, countries){
_.each(_.pluck(countries, 'name'), function(country){
console.log("country: " + country);
});
});
countryDict.inEurope('India', function(error, found){
console.log("Seriously? " + found);
});
Running Tests
Tests can be found in /test/api.test.js
$ npm test
License (MIT)
Copyright (c) 2016, Aymen Mouelhi.
Author: [Aymen Mouelhi]