1.0.0 • Published 2 years ago

country-city-multilanguage v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

country-city-multilanguage

A package to list all countries by a specific language (English, French, and Arabic), and also list cities by a country and a specific language.

Install

  npm install country-city-multilanguage

Get countries

To load the list of all countries use the getCountries function, this function takes 1 param lang

paramTypeoptions
langstring"en", "fr", "ar"

Example

const { getCountries } = require("country-city-multilanguage");

const countriesList = getCountries("fr");

console.log(countriesList);

Get cities

To load the list of all cities of an selected country use the getCities function, this function takes 2 params country_index & lang

paramTypeoptions
country_indexnumberthe index of country selected from the array retuend from the getCountries function
langstring"en", "fr", "ar"

Example

const { getCountries, getCities } = require("country-city-multilanguage");

const countriesList = getCountries("ar");

const citiesList = getCities(countriesList[0].index, "ar");

console.log(citiesList);